Skip to content

Commit

Permalink
comm: use strict
Browse files Browse the repository at this point in the history
* Add strict as done in other scripts
* COL[1] is the first element; COL[0] is a placeholder
* For my sample input files, the output is identical compared to previous version
* GNU comm prints a warning if input files are not sorted, but this version doesn't
  • Loading branch information
mknos authored Oct 27, 2023
1 parent 9217d2b commit d965c24
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions bin/comm
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,13 @@ License: public domain
# 1999 M-J. Dominus ([email protected])
# Public domain.
#
@COL[1,2,3] = (1,1,1);

use strict;

my @COL = (undef, 1, 1, 1);

if ($ARGV[0] =~ /^-[123]+$/) {
$opt = shift;
my $opt = shift;
while ($opt =~ /[123]/g) {
$COL[$&] = 0;
}
Expand All @@ -36,8 +39,8 @@ open F1, '<', $ARGV[0]
open F2, '<', $ARGV[1]
or die "comm: Couldn't open file $ARGV[1]: $!\n";

$r1 = <F1>;
$r2 = <F2>;
my $r1 = <F1>;
my $r2 = <F2>;

while (defined $r1 && defined $r2) {
if ($r1 eq $r2) {
Expand Down

0 comments on commit d965c24

Please sign in to comment.