Personally, I'd feel better doing it like this...
use strict;
my @dirlist = qw(/dir/to/parse);
open( FIND, '-|', 'find', @dirlist, qw/-print0/ ) or die "find: $!";
$/ = chr(0);
while (<FIND>) {
chomp;
print "Processing: $_\n";
}
Depending on what is really supposed to go on inside that while loop, I'd probably add more option flags to the qw// in the open statement (e.g. "-type f" or "-name *.foo" or whatever).
If the job happens to be traversing any relatively large directory tree (esp. when you get up into tens of thousands of files), you'll most likely be doing yourself a favor (in terms of run-time) by avoiding File::Find.
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.