Home > Archive > PERL CGI Freelance > March 2004 > Reading files with dates
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Reading files with dates
|
|
| Jason Vriends 2004-03-19, 1:26 pm |
| Can someone help me out. I'm trying to have perl read a directoy into an
array with the date of the file. I tried to use "LS" then have perl use
Regular Experssions but there must be an easier way
| |
| Vorxion 2004-03-19, 1:26 pm |
| In article <VjAsb.7418$iD1.6787@news04.bloor.is.net.cable.rogers.com>, Jason Vriends wrote:
>Can someone help me out. I'm trying to have perl read a directoy into an
>array with the date of the file. I tried to use "LS" then have perl use
>Regular Experssions but there must be an easier way
You don't really want an array, you want a hash. Key of filename, value of
date. That way your data is easily bound. DO NOT use the date as the key,
as you can have duplicates that will overwrite other entries.
perldoc -f opendir
perldoc -f readdir
perldoc -f stat
You'll be getting your timestamps from stat().
--
Vorxion - Member of The Vortexa Elite
| |
| Tintin 2004-03-19, 1:26 pm |
|
"Jason Vriends" <vriends@rogers.com> wrote in message
news:VjAsb.7418$iD1.6787@news04.bloor.is.net.cable.rogers.com...
> Can someone help me out. I'm trying to have perl read a directoy into an
> array with the date of the file. I tried to use "LS" then have perl use
> Regular Experssions but there must be an easier way
What the hell is "LS"? There's no such command (unless you like aliasing
every Unix command to uppercase)
perldoc -f glob
perldoc -f stat
will give you all the info you need, otherwise you can come an pay one of
the freelance experts here to do the job for you.
|
|
|
|
|