#!/usr/bin/perl -w use strict; use File::Find; my @directories = (".", "/home/mp3"); my @foundfiles; # Here, we collect all .mp3 files below each directory in @directories and put them # into @foundfiles find( sub { push @foundfiles, $File::Find::name if /\.mp3$/ }, @directories ); # and output them all print join("\n",@foundfiles), "\n";