![]() |
|
Syntactic Confectionery Delight | |
PerlMonks |
Re: Better way to get the results of grep()?by eye (Chaplain) |
on Dec 09, 2009 at 19:44 UTC ( #812017=note: print w/replies, xml ) | Need Help?? |
Rather than using an intermediate array and saving its first element, you could save the first element from the list that grep produces.
Note that using the 'o' modifier on the regular expression does not offer a benefit in this instance. It is only useful when the regular expression would be re-evaluated on each execution (as when it includes a variable).
In Section
Seekers of Perl Wisdom
|
|