laziness, impatience, and hubris | |
PerlMonks |
Re^2: Perl as grep (-p/next)by tye (Sage) |
on Dec 02, 2003 at 18:36 UTC ( [id://311709]=note: print w/replies, xml ) | Need Help?? |
duff++ Note that one of your examples: doesn't do what you think. -p puts the print statement in the while(<>) loop's continue block and so it will get called when you call next. So that one-liner prints all lines of a file named "*.*" (yes, you are correct about globbing, much to my consternation -- the reasons for this are nonsense), just not as efficiently because it applies a regex to each line and then effectively ignores the result of that test.
- tye
In Section
Seekers of Perl Wisdom
|
|