11. How to convert one liners into complete scripts?

Any Perl one-liner can be converted into a full script via the B:Deparser compiler, which is a core Perl module (so nothing to install).

perl -MO=Deparse -pe 's/this/that/g;'
ouputs

LINE: while (defined($_ = readline ARGV)) { # readline: each call reads and returns the next line of a file until end-of-file is reached
    s/this/that/g; # replace 'this' by 'that' globally
}
continue { # this continue block on a while loop ensures that the print function is always called
    die "-p destination: $!\n" unless print $_;
}
which you can save as e.g. this_that_replace.pl. To invoke this file, you need at least one inputfile as argument. This file (here: inputfile.txt) could contain the text 'This house is mine':

perl this_that_replace.pl inputfile.txt > outputfile.txt
The modified text 'That house is mine' is now saved into the file outputfile.txt (thanks to the > operator).