> Try:
>
> my @Music_files = ();
>
> use File::Find;
> find( \&want_mp3, 'd:\\' );
> print "$_\n" for sort @Music_files;
>
> sub want_mp3 {
>  push @Music_files, $File::Find::name if $_ =~ /\.mp3$/;
> }
>
>
> --
> Just my 0.00000002 million dollars worth,
>  Shawn
>
> Confusion is the first step of understanding.
>
> Programming is as much about organization and communication
> as it is about coding.
>
> The secret to great software:  Fail early & often.
>
> Eliminate software piracy:  use only FLOSS.
>

That was good to see Shawn. I kept working on it but mine was far more
convoluted, and didn't like spaces in directory names.

#!\usr\bin\perl
use warnings;
use strict;
use diagnostics;
use File::List;
use File::Find;

my $mp3;
my @musicFiles;
my $dirList;
my $dir = ("c:/");
my @dirList = find(sub {print if -d}, $dir);
# old file line $mp3 = new
File::List("C:/Users/RenshawFamily/maven/Music/Foo Fighters");
foreach $dirList (@dirList) {
        @musicFiles = @{ $dirList->find("\.mp3\$") };
}
@musicFiles = sort(@musicFiles);
foreach (@musicFiles)
{
         print " $_ ", "\n";
}

Sayth

--
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