in reply to Open file without changing modified date/time
Hi
Yes, on a win32 system, the inplace edit has to do it on a temp file, than copy the temp file back to the original. The only solution that comes to mind is to do the implace yourself:
}#!perl use strict; use warnings; undef $/; for my $file (@ARGV) { open F, $file or die $!; $_ = <F>; close F; $changed = 0; # put your code here, mark $changed if you made changes # For example: # $changed = s/this/that/g; if ($changed) { open F, ">$file" or die $!; print F; close F; } }
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Open file without changing modified date/time
by richz (Beadle) on Dec 06, 2004 at 20:52 UTC | |
by BUU (Prior) on Dec 07, 2004 at 07:01 UTC | |
|
Re^2: Open file without changing modified date/time
by richz (Beadle) on Dec 08, 2004 at 01:22 UTC | |
by graff (Chancellor) on Dec 08, 2004 at 03:32 UTC | |
by richz (Beadle) on Dec 10, 2004 at 04:45 UTC |