I think I got a case where I can reproduce this strange behaviour. At least I could provoke it several times repeatedly. Here is an example from the Windows command line (I'm using the DEL command to erase the file instead Perl's unlink; "ls" is the GnuUtil's ls.exe):

C:\>ls -l pid.txt -rw-rw-rw- 1 user group 4 Sep 15 16:51 pid.txt C:\>type pid.txt 8748 C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Thu Sep 15 16:45:56 2011 C:\>del pid.txt C:\>echo 8748 >pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Thu Sep 15 16:45:56 2011
We can see that the ctime did not change, although I erased pid.txt and created a new version! Now for a new experiment:
C:\>move pid.txt pid.old 1 file(s) moved. C:\>echo 8749 >pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Thu Sep 15 16:45:56 2011
First, I moved the old pid.txt away; then a created a new one. I still get the old time stamp!!! But now look at this:
C:\>del pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" Use of uninitialized value in localtime at -e line 1. :Thu Jan 1 01:00:00 1970 C:\>echo 8750 >pid.txt C:\>perl -lwe "print(':'.localtime((stat 'pid.txt')[10]))" :Tue Sep 20 11:30:49 2011
I delete the file, as in the very first example before. Then I run my perl command to display the ctime of the non-existing file. Not surprisingly, I get an error message. Now I re-create pid.txt and get the ctime. THIS TIME the ctime is up-to-date!!!!

The last (third) example differs from the first one only in that I asked Windows for the ctime of the *deleted* pid.txt. This seemed to "erase" the old timestamp somehow!

This doesn't look to me like a Perl problem anymore. It seems to be a pure Windows problem. My apologies for having it posted here...
-- 
Ronald Fischer <ynnor@mm.st>

In reply to Re^2: Re-Creating a file does not change inode modification time (Windows) by rovf
in thread Re-Creating a file does not change inode modification time (Windows) by rovf

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.