Hi,
I've got a loop that is searching an array for a match. When I hardcode the search pattern it works great but when I pass the search pattern in as a variable it doesn't find anything. Can someone advise?
Code is:
foreach my $search (@searchStrings) {
print "string: $search\n";
@holder = grep(!m/$search/,@mainFile);
print "size stripped: " . @holder . "\n";
print "size orig: " . @mainFile . "\n";
}
if I replace the grep line with:
@holder = grep(!m/VT02382933451687/,@mainFile);
it matches?
thanks
I've got a loop that is searching an array for a match. When I hardcode the search pattern it works great but when I pass the search pattern in as a variable it doesn't find anything. Can someone advise?
Code is:
foreach my $search (@searchStrings) {
print "string: $search\n";
@holder = grep(!m/$search/,@mainFile);
print "size stripped: " . @holder . "\n";
print "size orig: " . @mainFile . "\n";
}
if I replace the grep line with:
@holder = grep(!m/VT02382933451687/,@mainFile);
it matches?
thanks