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;
Sometimes I will add a map { "$dir/$_" } between = and grep, but it depends on the use.
In reply to Re^2: Is there a better way.
by afresh1
in thread Is there a better way.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |