Death Valley Plants
Stupid Perl Trick

Watch Video at YouTube!


This is a stupid little Perl trick that corrupts a file by performing a pattern substitution throughout the file. The example file is an image file. The following can be entered at a command prompt to corrupt a file:

    perl -pi -e 's/c/salami/g' file.jpg

This is a really simple little trick that anyone can try as long as they have Perl loaded on their computer. Perl comes standard with most flavors of Linux and with Mac OS X. While this trick as demonstrated in this video is kind of just a funny gimmick, command line substitution is a powerful tool, especially when combined with the use of regular expressions.

WARNING: Backup any images before experimenting with this trick. Some substitutions are potentially irreversible!!!



Back to Songs Index
Blackturtle.us Main Page