In the hope of clearing some (potential) confusion here... I think becca23 is referring to Time::localtime (which is where ctime is defined), which is of course not the same as localtime. Nevertheless, using your one-liner, I get the same answer with both functions (which is a GoodThing).

$ ls -l xyz.txt -rw-rw-r-- 1 x x 0 Jul 30 12:22 xyz.txt $ perl -le 'use Time::localtime; print ctime((stat)[9]) for @ARGV' xyz +.txt Wed Jul 30 12:22:28 2008 $ perl -le 'print scalar localtime((stat)[9]) for @ARGV' xyz.txt Wed Jul 30 12:22:28 2008
...still suspecting a time zone issue, but puzzled/worried by the 47 minute discrepancy, to say nothing of the approx 5 month discrepancy that comes with it...

In reply to Re^4: Getting the timestamp of a file by broomduster
in thread Getting the timestamp of a file by becca23

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.