in reply to matching an array
It's not very clear exactly what your program needs to do, but I think you want something a bit like this.
open FILE1, 'file1' or die $!; my @keys = <FILE1>; chomp @keys; my %keys = map { $_ => 1 } @keys; close FILE1; open FILE2, 'file2' or die $!; open FILE3, '>file3' or die $!; # output file print FILE3 grep { exists $keys{(split)[1]} } <FILE2>; close FILE2; close FILE3;
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
|
|---|