in reply to Re^2: multiple dir. grep
in thread multiple dir. grep

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