in reply to Regex capturing

It's all down to quoting. On *nix systems you need to use single quotes around your Perl to avoid the shell trying to expand $1:
echo "Hello Dolly" | perl -lpe 's/l(lo)/$1/' #Helo Dolly