http://qs1969.pair.com?node_id=61605


in reply to Double While!

I can see a number of things wrong here: Here's a quick example of a better way to do this:
#!/usr/bin/perl -w use strict; open(FILE1,"/tmp/file1") or die "Couldn't open /tmp/file1: $!"; open(FILE2,"/tmp/file2") or die "Couldn't open /tmp/file2: $!"; my @array; my %hash; while (<FILE1>) { chomp; push @array, $_; } while (<FILE2>) { chomp; $hash{$_} = ''; } close FILE1; close FILE2; foreach (@array) { if(exists $hash{$_}) { print "$_ matched!\n" } }