in reply to Having trouble with changing $1 of a regex

First of all: please use code tags around code samples, it is a wonder that your code is actually displayed correctly.

The following is at least working code, I'm not sure that it does anything you wanted. I changed the to-be-substituted character to something more visible

perl -e '$mystring="CONTENT- TYPE\n"; $mystring=~s/(.*)/{my $foo= $1; +$foo=~s\/N\/ \/; "$foo"}/e; print $mystring;' #prints CO TENT- TYPE

Note that to substitute \n in this example you would have to make sure that the '.' pattern recognises \n with a regex switch 's':

perl -e '$mystring="CONTENT- TYPE\n"; $mystring=~s/(.*)/{my $foo= $1; +$foo=~s\/\n\/ \/; "$foo"}/se; print $mystring;'