How To Modify Files Inline Using PERL Edit In Place

1 2 3 4 5 6 7 8 9 10 11 12 |
my $stamp = strftime "%Y%m%d%H%M%S", gmtime time; ## in-place update for the file our $^I = ".$stamp"; local @ARGV = ($fullpath); while ( <ARGV> ) { if (/$regex/) { next; } # this print is the critical part to write the line back to the file print; } $^I = undef; |