in reply to Converting FILEHANDLE to string
This has problems if your file/string is huge. There is also a Tie::Slurp module or somesuch but I admit I haven't had it working yet.use File::Slurp; my $string = read_file("yourfile"); write_file("yourfile.bak", $string); $string =~ s/everything/otherthings/g; $string .= "endbit\n"; write_file("newfile", $string);
|
|---|