in reply to grab newest file
a) if it works, why fight it? ;-)
b) what that does does not match what your subject says. That will give you the last file alphabetically, not the oldest file.
If you want the same functionality:
(the sort probably isn't needed, but not all filesystems sort their directories automatically)$report = (sort glob "$path/*B1006*")[-1];
If you actually want the oldest file:
(The definition of "oldest" is a bit fuzzy since the info you may want may not be present. This uses modification times - probably close enough.)$report = (sort { -M $a <=> -M $b } glob "$path/*B1006*")[-1]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: grab oldest file
by hasimir44 (Sexton) on Jul 06, 2006 at 23:29 UTC | |
by Tanktalus (Canon) on Jul 06, 2006 at 23:43 UTC | |
by hasimir44 (Sexton) on Jul 06, 2006 at 23:49 UTC | |
by jwkrahn (Abbot) on Jul 07, 2006 at 00:06 UTC | |
by shmem (Chancellor) on Jul 07, 2006 at 06:36 UTC | |
by jwkrahn (Abbot) on Jul 07, 2006 at 11:25 UTC |