The stupid question is the question not asked | |
PerlMonks |
Re: file globbing in a nested while loopby pjf (Curate) |
on Oct 05, 2001 at 16:44 UTC ( [id://116975]=note: print w/replies, xml ) | Need Help?? |
G'day George,
There's a module that does exactly what you're looking for, it's called File::Find. It allows you to traverse a file tree, and (should you so desire) perform operations based upon each file you come across. Here's some code that demonstrates how to use File::Find to find and print the location of .pl files. If you don't like to specify the sub-routine seperately, you can do it with an anonymous subroutine. Please note that newer versions of File::Find contain some very rich features, much more than the manual page here on PerlMonks. Check your local install to see what extra fun you can find. Hope you find this useful.
Cheers,
In Section
Seekers of Perl Wisdom
|
|