end subroutines with return
authorMischa POSLAWSKY <perl@shiar.org>
Sat, 22 Feb 2020 00:47:57 +0000 (01:47 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Sun, 17 Apr 2022 17:20:25 +0000 (19:20 +0200)
Stern perlcritic complaint, referencing page 197 of PBP.

barcat

diff --git a/barcat b/barcat
index 7a0bf878fab83ce4c5b06d2364685be35d4f9649..b0237c4eb249f923940f1c56df1376dfbd14a182 100755 (executable)
--- a/barcat
+++ b/barcat
@@ -185,7 +185,7 @@ sub color {
 sub sival {
        my $unit = int(log(abs $_[0] || 1) / log(10) - 3*($_[0] < 1) + 1e-15);
        my $float = $_[0] !~ /\A0*[-0-9]{1,3}\z/;
-       sprintf('%3.*f%1s',
+       return sprintf('%3.*f%1s',
                $float && ($unit % 3) == ($unit < 0),  # tenths
                $_[0] / 1000 ** int($unit/3),   # number
                $#{$opt{units}} * 1.5 < abs $unit ? "e$unit" : $opt{units}->[$unit/3]
@@ -290,6 +290,7 @@ continue {
 }
 say $opt{palette} ? color(0) : '' if $opt{spark};
 
+       return $nr;
 }
 
 sub show_stat {
@@ -310,6 +311,7 @@ sub show_stat {
                );
        }
        say '';
+       return 1;
 }
 
 sub show_exit {