Skip to content

Commit 95b79a8

Browse files
authored
join: confusing declarations
* Simplify code in get_opt() to make it clearer to reader that there is only one function parameter, i.e. $arg * Update 2 loops using until-not pattern instead of regular while pattern; found by perlcritic %perl cat names # regression test 1 BoB 2 Budii 3 B-LITE 10 BLINK %perl cat prices 1 $500 2 $30 3 50c 6 $2 %perl join names prices 1 BoB $500 2 Budii $30 3 B-LITE 50c
1 parent 0a69975 commit 95b79a8

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

bin/join

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,12 @@ while (@buf1 && @buf2) {
132132
if ($unpairables[0] && @buf1) {
133133
do{
134134
print_joined_lines(shift @buf1, [])
135-
} until !get_a_line(\@buf1, $fh1);
135+
} while get_a_line(\@buf1, $fh1);
136136
}
137137
if ($unpairables[1] && @buf2) {
138138
do{
139139
print_joined_lines([], shift @buf2)
140-
} until !get_a_line(\@buf2, $fh2);
140+
} while get_a_line(\@buf2, $fh2);
141141
}
142142

143143
unless (close $fh1) {
@@ -195,8 +195,9 @@ sub print_joined_lines {
195195
# OPTIONS STUFF BELOW #
196196
#######################
197197
sub get_arg {
198-
# $_ contains current arg
199-
my ($arg,$opt) = shift;
198+
# $_ contains VAL in -oVAL
199+
my $arg = shift;
200+
my $opt;
200201
if (length) { $opt = $_ }
201202
elsif (@ARGV) { $opt = shift @ARGV }
202203
else {

0 commit comments

Comments
 (0)