From e0ac19d7c06e2c545f9ed0acd468ea728015f521 Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sat, 26 Aug 2023 12:50:48 -0400 Subject: [PATCH] simplify code --- script.pl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/script.pl b/script.pl index 3a157d6..027e61f 100644 --- a/script.pl +++ b/script.pl @@ -80,10 +80,13 @@ sub generate_output_table ($ts) { } # sort hash by the average and print to screen - return Text::SimpleTable::AutoWidth->new( + my $tbl = Text::SimpleTable::AutoWidth->new( captions => [qw/ Computer GHZDaysPerDay /] ); + foreach my $key ( reverse sort { $ranks{$a} <=> $ranks{$b} } keys(%ranks) ) { $tbl->row( $key, $ranks{$key} ); } + + return $tbl; }