The only time I can remember using a look-ahead in work code was when I was writing a script that would peer through our CVS tree every Tuesday and print out all of the source code that was modified in the last week. (This forced us to do code reviews on Tuesday because we would walk in to the office and see the heaping pile of code.)
At any rate, we only wanted to print out certain files in our CVS (we keep everything, there). We did not want to print .txt or .html or other files like that. So, to accomplish this, I did the following:
opendir PROJ, "./$currentProject" or die "Could not open CVS dir $curr
+entProject: $!\n";
my @files = grep /((\w|_)+(?=\.(pl|php|inc|js)$))/, readdir PROJ;
closedir PROJ;
I look forward to your book.
Jeremy
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:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.