Say you want to rename a bunch of files in a directory that have a common naming convention to something else…this is a quick script to do just that for you…

perl -e 'my @ls = `ls -1`;foreach (@ls) {chomp; if (/file/) 
{my $change = $_;$change =~ s/(fileS+)/this$1/g; `mv $_ $change`;}}'

so this would take a bunch of files (in the current directory) and if they had the word file in the name this would prepend the name “this” on the front.   For example:
file1.log
file2.log
would be changed to
thisfile1.log
thisfile2.log
and so on…

This is a very powerful way to change the names of many files in a directory quickly and with complete control using regular expression.