Clifford Bracht <> wrote:
> I'm tring to write a script that verifies if the time of the last
> modification is more recent than the time of the last access.
A modification _is_ an access, _both_ timestamps are updated.
This has nothing to do with Perl.
> my
> atime and mtime are the same number no matter what kind of changes I
> make to the file.
That is how it is supposed to be right after the modification.
Are they different when you do a access (non-modifying) between
the modification and your Perl program?
> open FILEHANDLE, $filename or die "Cannot open $filename,
Why are you open()ing the file?
You do not need to open the file to examine its timestamps.
> #While file is open do the following...
That comment is misleading.
The file will _still_ be open, even after the while()
condition becomes false.
# while there are lines left in the file
Except now it repeats what is already said in the code, a sign
that it is a "bad" comment.
> while (<FILEHANDLE>)
Why are you looping through all the lines in the file?
You never use them in your program.
> my $atime = (stat ($filename))[8] || die "Sorry, cannot stat! \n";
> my $mtime = (stat ($filename))[9] || die "Sorry, cannot stat! \n";
my($atime, $mtime) = (stat $filename)[8] || die "Sorry, cannot stat! \n";
> if ($mtime == $atime) #$mtime = $ctime)
Huh?
What were you hoping that that line of code would do?
--
Tad McClellan SGML consulting
Perl programming
Fort Worth, Texas