[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Omaha.pm] Less is more



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",@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