in reply to Reading from file- not change atime
When opening a filehandle, use
utime:
#!/usr/bin/perl use strict; use warnings; no warnings qw(uninitialized); use File::stat; my $file = shift or die $!; open my $fh, '<', $file or die $!; my ($atime, $mtime) = (stat($fh))[8,9]; utime($atime, $mtime, $fh) or die "couldn't restore $file to original times: $!"; close $fh;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Reading from file- not change atime
by Eliya (Vicar) on Dec 10, 2013 at 15:45 UTC |
In Section
Seekers of Perl Wisdom