in reply to filtering file names to be added to an array...maybe.
foreach $file (@files){ next unless $file =~ /\.dat$/; # other stuff here... } [download]