in reply to Simple file editing problems
explanation can be found hereuse strict; use warnings;
not the nicest code, but who cares.use strict; use warnings; open (FILE, "<test.data") or die "open: $!"; my @file_contents = <FILE>; close (FILE); @file_contents = map {s/stefan/kabel/g; $_;} @file_contents; open (FILE, ">test.data") or die "open 2: $!"; print FILE $_ foreach (@file_contents); close (FILE);
|
|---|