Hints and tips on perl

These are some helpful hints on various topics.

 

Perl inline replacement on Windows


Replacing some string in multiple files is one pretty feature of Perl. Just execute
 
perl -p -i -e 's/SEARCH/REPLACE/g' file.txt
and all SEARCH in file.txt transforms to REPLACE. On Windows there's a catch: this does not work with single quotes. So to get it working use
 
perl -p -i -e "s/SEARCH/REPLACE/g" file.txt