Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- # Cause my parents brought me up that way...
- use strict;
- # Put the filename that was passed as runtime into a variable.
- my $filein = shift;
- # Open the file and read the contents in as a string.
- my $file_contents = open_s($filein);
- # Do a search & replace regex on the contents of the file.
- $file_contents =~ s{<([^>]*?)>}{>$1<}gi;
- # Another regex to change them back.
- $file_contents =~ s{>([^>]*?)<}{<$1>}gi;
- # Change the name of the file by running a search & replace regex on it's name.
- $filein =~ s{\.html}{_new\.html};
- # Save the file.
- save_s($filein, $file_contents);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement