[Omaha.pm] Less is more

Ryan Stille rps at willcomminc.com
Thu Dec 22 09:50:55 PST 2005


I am was trying to get this done in one line, just for the heck of it.
I need the modification time of a file referenced by $file ($file
contains the path and filename of the file).

@filedate = localtime((stat($file))[9]);
($month,$day,$year) = split(/\//,strftime("%D", at filedate));

But I can't seem to put localtime in place of @filedate:

($month,$day,$year) =
split(/\//,strftime("%D",localtime((stat($file))[9])));

Gives me: Type of arg 2 to Date::Format::strftime must be array (not
localtime)

So I tried to make localtime() return as an array, and here is where I'm
not so sure as to what I'm doing.

I tried this:

($month,$day,$year) =
split(/\//,strftime("%D",(localtime((stat($file))[9]))));

And this:

($month,$day,$year) =
split(/\//,strftime("%D",(localtime((stat($file))[9]))[]));

Which didn't work either.  What am I doing wrong?

Thanks,
-Ryan



More information about the Omaha-pm mailing list