a very short Perl program, generally entered entirely on the command line, using the '-e' switch, also often using implicit looping over input lines with the '-n' switch, implicit looping and printing with the '-p' switch, and in-place editing with the '-i(extension)' switch..

This example replaces all occurrences of the word 'Bob' with the word 'Fred' in file.txt.

perl -ipe 's/\bBob\b/Fred/g;' file.txt

Log in or register to write something here or to contact authors.