CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Help with stat!



Jul 5, 2000, 9:15 AM

Post #1 of 2 (251 views)
Help with stat! Can't Post

I need help getting the timestamp from a file and I'm using the command "status" as follows but all I get is an empty string. I'm really having a hard time.. This is the line of code that gets the timestamp:

($readtime,$writetime) = (stat($File::Find::name))[8,9];

What is wrong with this code?


Jul 5, 2000, 11:36 AM

Post #2 of 2 (251 views)
Re: Help with stat! [In reply to] Can't Post

If you're doing this from the callback you passed to find() or finddepth(), then try using $_ instead of $File::Find::name.

You might have to read between the lines of the pod in to see why this is so, but it has to do with $File::Find::dir being prepended to $File::File::name and being chdir'd to $File::Find::dir when the callback is invoked. If you start the find from a relative path, then $File::Find::name might be fine for pretty-printing, but it's useless for stat.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives