#!/usr/local/bin/perl # # vii - edit file(s) without changing the timestamp (invisible vi) # # based on uvi from the Perl Cookbook foreach $file (@ARGV) { # save old times ($atime{$file},$mtime{$file}) = (stat($file))[8,9]; } system($ENV{EDITOR} || "vi", @ARGV); # edit foreach $file (@ARGV) { # restore times utime($atime{$file},$mtime{$file},$file) || die "couldn't restore $file to original times: $!\n"; }