in reply to Double While!
Because you can only have one $_. But if I understand what you want to do you can try this:
open(KEYWORDS,"/tmp/file1") or die "cannot open /tmp/file1: $!"; my %keywords= map { ($_, 1) } <KEYWORDS>; # create a hash keyword => +1 open(STUFF_TO_MATCH,"/tmp/file2"); or die "cannot open /tmp/file2: $!"; while(<STUFF_TO_MATCH>) { print "$_ matched!\n" if($keyword{$_}); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re (tilly) 2: Double While!
by tilly (Archbishop) on Mar 15, 2001 at 17:45 UTC |