Next | Tricks of the Wizards | 123 |
Sort list of items by some non-apparent feature
Example: Sort filenames by last-modified date
Obvious method is very wasteful:
sort { -M $b <=> -M $a } (readdir D);
Calls -M over and over on the same files
Another idea:
Construct data structure with both names and dates
Sort by date
Throw away dates
Next | Copyright © 2003 M. J. Dominus |