Why not:

  my $spec = "/var/www/*.mp3";
  my ( @files ) = glob $spec;
  print "Checked '$spec' - found ", scalar(@files), " files:\n  ",
        join("\n  ", @files ), "\n";

regards
Jeff


> -----Original Message-----
> From: Fabian Funk [mailto:[EMAIL PROTECTED]] 
> Sent: 04 September 2002 20:42
> To: [EMAIL PROTECTED]
> Subject: Reading Directory
> 
> 
> Hi, I'm pretty new to perl. I want to open a Directory with 
> mp3 files an 
> other files. My Poblem is i need only the mp3 files. How can 
> i get only 
> the mp3 files and not other files ?
> 
> I tried:
> 
> while (defined(my $file=readdir(DIR))) {
>       next if $file=~ /^\.\.?$/;
>       next unless /\.[mp3]$/i;
>       push(@files,$file);     
> 
> But i get "Use of uninitialized value in pattern match (m//)
> What's wrong ???
> 
> 
> -- 
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to