[PLUG] Grab the most recent file in perl?

Felix Lee felix.1 at canids.net
Thu Feb 13 19:02:01 UTC 2003


Jeme A Brelin <jeme at brelin.net>:
> $newest = (sort { -M $a <=> -M $b } <*> )[0]

that does O(N log N) I/O operations.
calling 'ls -t' does O(N).
the difference is probably unimportant, unless you have
a million files or a slow filesystem.
--




More information about the PLUG mailing list