in reply to using grep to search an array
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!
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: using grep to search an array
by alicatserver (Initiate) on May 23, 2011 at 20:46 UTC | |
by John M. Dlugosz (Monsignor) on May 23, 2011 at 20:53 UTC | |
by alicatserver (Initiate) on May 23, 2011 at 21:11 UTC | |
by alicatserver (Initiate) on Jun 06, 2011 at 21:54 UTC |
In Section
Seekers of Perl Wisdom