in reply to Re: Directory Listing
in thread Directory Listing

If your trying to cut it down then you don't really need the hash, since an array dereference is maybe/probably faster than a hash lookup.
my $dir = shift || "."; my $field = shift || 10; opendir(DIRH, $dir) or die "Cannot open $dir: $!"; for ( sort { $b->[1], $a->[1] } map { [ $_, (stat("$dir/$_"))[$field] ] } grep { !/^\.\.?$/ && /pm$/ } readdir(DIRH) ) { print join("\t", @$_) . "\n"; } closedir(DIRH);

Update: fixed a few errors, which turnstep pointed out.