>>>>> "Thomas" == Thomas Jakub <[EMAIL PROTECTED]> writes:

Thomas> I'm trying to see when a file was last modified.
Thomas> Here's the code segment...

Thomas> open filename, ">temp";
Thomas> #random time consumming statements go here
Thomas> $then = time;
Thomas> utime $then, $then, filename;
Thomas> print $then;
Thomas> close filename;

Thomas> The problem is, every time I do this, I don't get the
Thomas> time of when I last added something to the file, but
Thomas> instead the most recent time in which I was able to
Thomas> add something to the file...  How can I get the time
Thomas> at which the file was last modified?

The close() has to do a flush, which may write something new to the
file.  So, close first, utime later.

Also, please use uppercase filehandle names.  If you are reading a
book that uses lowercase names, please throw that book away.
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

Reply via email to