in reply to Directory Listing
my $dir = shift || "."; my $field = shift || 10; opendir(DIRH, $dir) or die "Cannot open $dir: $!"; my %file = map { $_ => (stat("$dir/$_"))[$field]} grep { !/^\.\.?$/ && /pm$/ } readdir DIRH; closedir(DIRH); for (sort { $file{$b} cmp $file{$a} } keys %file) { print "$_ , $file{$_} \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Directory Listing
by repson (Chaplain) on Jan 09, 2001 at 18:29 UTC |