in reply to Re: Perl as grep
in thread Perl as grep
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.perl -pe "next unless /regex/" *.*
|
|---|