http://qs321.pair.com?node_id=1231297


in reply to Trouble with back-references on Windows

Quoting is somewhat of a mess in Perl one-liners under Windows (which is one of the reasons why I prefer to use Cygwin or bash for Windows when I have to work with Windows). It is usually better to use double quotes for the one-liner script, but that makes interpolating quotes slightly more difficult to use.

This works with the Windows command prompt:

C:\Users\Laurent>echo "abcd" | perl -nle "/(b).(d)/ && print qq/$1 $2/ +;" b d