my %h; open my $fh, " ) ) { $h{$_} = $.; } open my $fh2, " ) ) { if ( exists $h{$_} ) { print "line $. is a dup of line $h{$_}\n"; } }