Information Technology Grimoire

Version .0.0.1

IT Notes from various projects because I forget, and hopefully they help you too.

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.

my @mp3s = glob "./*.mp3";
foreach my $in (@mp3s) {
  print $in . "\n";
}
Last updated on 2 Jan 2019
Published on 2 Jan 2019