Perl List Files in Directory
If you want to list all of the files in a directory, you can use glob.
The following Perl code will put all “mp3” files in an array called @mp3s. The sample loop shows how to loop over that loop.
1 2 3 4 |
my @mp3s = glob "./*.mp3"; foreach my $in (@mp3s) { print $in . "\n"; } |