It's quicker to code it than to explain it:
use strict; my @dirs = qw(dir1 dir2 dir3); my @files; for my $dir ( @dirs ) { opendir my $dh, $dir or die "opendir failed: $dir ($!)\n"; push @files, grep -f $_, readdir $dh; } my @sorted = map $_->[ 0 ], sort { $b->[ 1 ] <=> $a->[ 1 ] } map [ $_, (/(\d+)/)[ 0 ] ], @files; __END__
the lowliest monk
In reply to Re^3: multiple dir. grep
by tlm
in thread multiple dir. grep
by Cockneyphil
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |