I tend to use Perl as a grep on steroids. All that you have to do is:
and it works like grep, except that the condition can be written in Perl. I use this when I want to use a complex regular expression and I can't be bothered to remember how grep's differ from Perl's. I also use this when I want a condition that I can readily write in code.perl -ne 'print if _____' somefile
That is fine, except that GNU grep does something that I really like. If you type:
then it will recursively search through bar and grep for "foo" in each file. No need to mess around with find. No need to mess around with File::Find. Just a simple -r and It Just Works.grep -r foo bar
Who else would find it convenient if Perl, when it was invoked with -r, would take what is to become your @ARGS and recursively walk the directory tree to expand it out? That way my "grep on steroids" would trivially have the same feature that I have come to know and love in GNU's version of grep.
I'd appreciate a similar optional feature built into glob in some way...
In reply to Useful addition to Perl? by tilly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |