in reply to Selectively replacing characters inside a string

It's also possible to use nested substitutions (I've use single-quotes instead of double-quotes to avoid the WinNoyance® of escaping a bunch of "s):
>perl -wMstrict -le "for my $str (@ARGV) { print $str; $str =~ s{ (' [^']* ') } { (my $x = $1) =~ s{ [^'/] }{x}xmsg; $x }xmsge; print $str; } " file='path/goes/here' foo'a/b/c'bar '///' 'a/b/c' file1='aa/bb/cc',file2='/dd/' file='path/goes/here' file='xxxx/xxxx/xxxx' foo'a/b/c'bar foo'x/x/x'bar '///' '///' 'a/b/c' 'x/x/x' file1='aa/bb/cc',file2='/dd/' file1='xx/xx/xx',file2='/xx/'