in reply to Search List
my @patterns; foreach my $pattern (`ls`) { chomp $pattern; push @patterns, qr/\Q$pattern\E/; } open(IN,"test.txt") or die "Can't open test.txt: $!\n"; while(my $line = <IN>) { chomp $line; foreach my $pattern (@patterns) { print "Match found\n" if $line =~ $pattern; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Search List
by holli (Abbot) on Dec 20, 2005 at 18:25 UTC |