Here is a random thought that struck me last night. I've mulled it over for a bit, and it doesn't seem worse than it originally did, so I'm putting it up for discussion to see if other people agree.
I tend to use Perl as a grep on steroids. All that you have to do is:
perl -ne 'print if _____' somefile
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.
That is fine, except that GNU grep does something that I really like. If you type:
grep -r foo bar
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.
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...
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
| & || & |
| < || < |
| > || > |
| [ || [ |
| ] || ] ||