Brian Volk wrote:
Hi All~
I'm using the glob function to grab all the files in a given directory
and
then using crontab to check it every 5 minutes. Once I have the files
I'm
using the diamond operator to read every line in every file and *do
something* if the line matches. Here's my questions:
Given directory:
File 1 - in dir at 9:01
File 2 - in dir at 9:02
File 3 - in dir at 9:03
I would like to process the File 1 first then File 2 and then File 3.
Each
file contains data that I need to print for that order. If I can
process
the orders (File 1, File 2, File 3) according to the time they entered
the
given dir (first in/first out) the data will print off in the correct
sequence.
This will load @ARGV with the files in the current directory sorted
oldest -> newest:
@ARGV = map $_->[0],
sort { $b->[1] <=> $a->[1] }
map [ $_, -M ],
grep -f, # get only plain files
<*>;
How it works is left as an exercise for the reader :-)
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>