in reply to $ variables in command line

I'm guessing it never makes it into the script, and is instead gobbled by the shell. Try escaping the $: ./replace.pl -s "<html(.*)>" -r "<head\$1>"

Update: yup. perl -e"$foo = 3; print $foo;" demonstrates.

I see kvale pointed out a solution below.