Perl: the Markov chain saw | |
PerlMonks |
Re: push to an array lines matching a pattern, and the lines before and after the matchingby JavaFan (Canon) |
on Mar 02, 2012 at 21:40 UTC ( [id://957556]=note: print w/replies, xml ) | Need Help?? |
Your Perl solution slurps in the entire file, one line per element, copies the entire contents to @_, copies that once more into @n lexical to the sub.
Unix grep doesn't do any of that. I would not be ashamed to call out to an external program. No need to reinvent the wheel, even if the wheel isn't found on CPAN.
In Section
Seekers of Perl Wisdom
|
|