in reply to Is there a better way.
The way I normally do this is similar, but skips using the temporary @files array.
opendir my $dh, $dir or die "Unable to opendir [$dir]: $!"; my @uploads = grep /$pattern/, readdir ($dh); closedir $dh; [download]
Sometimes I will add a map { "$dir/$_" } between = and grep, but it depends on the use.