At 03:40 -0700 12/06/2011, eventual wrote:

I've read perldoc File::Find but I dont understand.
So If I wish to search for "mp3" in d:\ and all its sub-directories, and to print it out if found,
How should I write?

Just put the directory in $dir:


#!/usr/local/bin/perl
use strict;
use File::Find;
my $dir = "$ENV{HOME}/music";
my @mp3list;
find(\&LIST_PATHNAMES, $dir);
for (@mp3list){
        print "$_\n\n";
}
sub LIST_PATHNAMES{
        push @mp3list, $File::Find::name if /\.mp3$/;
}


JD

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to