in reply to retaining TIMESTAMPS
$mtime=(stat ( $ARGV[0] ))[9]; # mtime is 9 , atime is 8!!
That is to say , stat the file given as the first (index 0) argument to your script, assigning the eighth element in the stat list to the variable $mtime.
have a go with this....Of course , anything else modifying this file that DOESN'T reset the timestamp is going to throw an irish-screwdriver in the works.#!/usr/bin/perl -w use strict; my $mtime = (stat ( $ARGV[0] ))[9]; print "$mtime\n"; open ( F , '>>' ,$ARGV[0] ); print F 'japh'; close F; utime $mtime, $mtime, $ARGV[0]; $mtime = (stat($ARGV[0]))[9]; ## Update, this is supposed to be a 9 RE +ALLY print "$mtime\n";
|
|---|