Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: grepping arraysby George_Sherston (Vicar) |
on Jun 21, 2003 at 21:52 UTC ( [id://267875]=note: print w/replies, xml ) | Need Help?? |
I think the main thing going wrong is that your first argument needs to be a block of code rather than a scalar. grep works by running the block of code for each element in the array and returning the number of times it was true (or, if you did @output = grep... it gives you the list of elements from your input array for which it was true... but you don't care about that).
So this ... may do what you want. (the \bs are so you only catch whole words). § George Sherston
In Section
Seekers of Perl Wisdom
|
|