Mathew Snyder schreef:
> foreach my $file (sort(readdir DH)){
> next if ($file =~ /^.%|^..$/);
> my $mod_time = (stat($file))[9];
> $filenames{$file} = $mod_time;
> }
No need to sort before you put things in a hash: hashes don't keep
order.
Try this:
my %file_modtime = map { m~([^/]*)$~ => (stat)[9] } grep -f,
</usr/bin/*>
The capturing regex
m~([^/]*)$~
isolates the filename, you can also use
(split '/')[-1]
or a basename-function from some module.
--
Affijn, Ruud
"Gewoon is een tijger."
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>