# Taken from a message sent by Tom Christianson to
# comp.lang.perl.misc
## Reverse all the lines in a file, or set of files
perl -e 'print reverse <>' filename1, filename2, ...
## Increment all the numbers in a file by 1
perl i.tiny -pe 's/(\d+)/1 + $1/ge' filename1, filename2, ...
## Binary edit
perl -i.bak -pe 's/Mozilla/Slopoke/g' `which mozilla`
## Look for duplicate words
perl -0777 -ne 'print "$,: doubled $_\n" while /\b(\w+)\b\s+\b\1\b/gi' < filename
## In-place edit of *.c files changing all foo to bar
perl -p -i.bak -e 's/\bfoo\b/bar/g' *.c