go ahead... be a heretic | |
PerlMonks |
Re: recurse directories?by Dominus (Parson) |
on Mar 12, 2000 at 03:25 UTC ( [id://5229]=note: print w/replies, xml ) | Need Help?? |
You want to use the File::Find module that comes with Perl. With File::Find you tell it what directory you want to search, and you supply a wanted subroutine that it invokes on every file that it finds. Inside of wanted, you get to do whetever you want, or you can just return immediately if you're not interested in a particular file. Your wanted might look like this: sub wanted { return unless /\.mp3$/ || /\.pl$/; # do something with the .mp3 or .pl file }
In Section
Seekers of Perl Wisdom
|
|