From 1200d9832344e9dbbb22649caa59bc228e1d6b6c Mon Sep 17 00:00:00 2001 From: Yanick Champoux Date: Sat, 26 Aug 2023 12:19:43 -0400 Subject: [PATCH] use sprintf to round --- script.pl | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/script.pl b/script.pl index d59b9e9..a6aa4da 100644 --- a/script.pl +++ b/script.pl @@ -72,9 +72,7 @@ sub generate_output_table ($ts) { # create hash with each computer and its average GHz Days per day my %ranks = pairmap { - my $mean = sum( @$b ) / @$b; - my $rounded = int( $mean + 0.5 ); - $a => $rounded; + $a => sprintf "%.0f", sum(@$b)/@$b; } %$list; # sort hash by the average and print to screen