sub recursive_filelist { my $dir = $_[0]; $dir .= '/' if($dir !~ /\/$/); $dir .= '*'; my @list = glob($dir); my @files; foreach my $variable (@list) { my $full = $path . $variable; if( -d $full) { my @morefiles = recursive_filelist($full); push(@files, @morefiles); } elsif (-f $full) { push(@files, $full); } } return @files; }