No such thing as a small change | |
PerlMonks |
Re: using grep to search an arrayby John M. Dlugosz (Monsignor) |
on May 23, 2011 at 20:14 UTC ( [id://906356]=note: print w/replies, xml ) | Need Help?? |
Are you looking for lines exactly the same or just prefixes? If the latter, the "\n" at the end of $testit will get in the way. In any case, you are overwriting @grepnames each time through the loop, so you will only return the matches from the last line of FILEA. Try push @grepnames, grep... instead. And use strict and warnings!
In Section
Seekers of Perl Wisdom
|
|