perl stuff

useful perl one liners

perl environment

which modules are installed?
perl -MFile::Find=find -MFile::Spec::Functions -lwe 'find { wanted => sub { print canonpath $_ if /\.pm\z/ }, no_chdir => 1 }, @INC'
find out about a particular module
perl -MMy::Module -e 'print 1'

find & replace

find and replace text in a file
perl -pi -e 's!/replace/this/!/with/this/!g' file.php
find and replace text in all file
perl -pi -e 's!/replace/this/!/with/this/!g' *
... now backup each file just in case you ruin it
perl -pi.bak -e 's!/replace/this/!/with/this/!g' *

pointless stuff

word mangler
perl -pe 's{(?<=\W\w)(\w\w+)(?=\w\W)}{ my $s; $s= rand(100) > 50 ? qq|$s$_| : qq|$_$s| for (split //, $1); $s; }eg;' < inputfile > outputfile