From: Mischa POSLAWSKY Date: Sat, 7 Sep 2019 18:28:17 +0000 (+0200) Subject: omit empty value statistics X-Git-Tag: v1.04~1 X-Git-Url: http://git.shiar.nl/barcat.git/commitdiff_plain/409c90c0c170f9d91ffaa2c22a2fdaa878bd8cb1?hp=cdad4c9fc575cb94974ae27e451aed47fc072710 omit empty value statistics --- diff --git a/barcat b/barcat index 4c3cf8a..600f453 100755 --- a/barcat +++ b/barcat @@ -181,11 +181,13 @@ if ($opt{stat}) { $opt{hidemax} ||= @lines; printf '%s of ', sum(@values[$opt{hidemin} - 1 .. $opt{hidemax} - 1]) // 0; } - my $total = sum @order; - printf '%s total', $total; - printf ' in %d values', scalar @values; - printf ' (%s min, %*.*f avg, %s max)', - $order[-1], 0, 2, $total / @order, $order[0]; + if (@order) { + my $total = sum @order; + printf '%s total', $total; + printf ' in %d values', scalar @values; + printf ' (%s min, %*.*f avg, %s max)', + $order[-1], 0, 2, $total / @order, $order[0]; + } say ''; }