in reply to Re: Using array elements for a file search
in thread Using array elements for a file search
But obviously that's rather inefficient and takes for ever. Could your example, of joining the array to a regular expression string, be modified and used in this case where it needs to match the end of the string?my @zones = `cat zones.txt`; chomp (@zones); open (IN, 'logfile.log'); while (<IN>) { chomp; foreach my $zone (@zones) { if ($_ =~ /$zone$/) { print "$zone match\n"; last; } } } close IN;
|
---|