Skip to content

Instantly share code, notes, and snippets.

@dbb
Created July 16, 2011 18:31
Show Gist options
  • Save dbb/1086620 to your computer and use it in GitHub Desktop.
Save dbb/1086620 to your computer and use it in GitHub Desktop.
use File::Copy;
copy("file.html","file.html.orig");
open(my $out, ">", "file.html.tmp");
open(my $in, "<", "file.html");
for ( @lines ) {
s/$pattern/${replacement}\n$pattern/g;
say $out $_; #########################################################
# you have to print to the file
}
# then copy the output to the proper file name
copy("file.html.tmp", "file.html");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment