March 2002 | Perl Hardware Store | 6 |
Schwartzian Transform
We can get an easy speed improvement here:
Replace hashes { NAME => $_, DATE => -M $_ }
...with arrays [ $_, -M $_ ]
Also, we usually eliminate the temporary variables:
@sorted_names = map { $_->[0] } sort { $b->[1] <=> $a->[1] } map { [ $_, -M $_ ] } readdir D;
This is the Schwartzian Transform
Next | Copyright © 2002 M-J. Dominus |