Lee Goddard ([EMAIL PROTECTED]) wrote:
> opendir opens a directory so the contents can be listed.
> utime changes the modification times associated with the file.
> stat will give you the last modified time (as will -M).
> 
> warn -M $file;
> warn ((stat ($file))[9])


Trevor Joerges ([EMAIL PROTECTED]) wrote:
> Try perldoc -f -M.
> 
> my $modtime = -M file; # will get you the last modified time in days.

A correction for Lee and Trevor. The "-M" function is not 
the same as  (stat $file)[9] which is what the original
poster wanted (i.e. mtime of a file).

Here is the section from perldoc -f -M :

   -M  Age of file in days when script started.

Let's try it. I have two files in my current dir doit.bat and doit.sh:

  > ls -l doit.*
  -rwxr-xr-x    1 marms    pwrusers     1360 Feb  6  2003 doit.bat
  -rwxr-xr-x    1 marms    pwrusers     1502 Jul 17 11:27 doit.sh

So I run this test:

  perl -e 'for (@ARGV) { print "$_ : -M=", -M $_, "  mtime=", (stat $_)[9],
"\n" }' doit.*

Produces this as output:

  doit.bat : -M=222.013171296296  mtime=1044548597
  doit.sh : -M=60.9687268518519  mtime=1058462837

Hope this helps.

--
Mike Arms


_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to