in reply to Replacing comas in a substring when it is between quotes

Yes, use a CSV module, but if you just gotta know (I use single-quotes instead of double-quotes to keep Windoze happy):

>perl -wMstrict -le "my $s = q{w,ww,'a,bb,ccc,3 ,ee,',4,'a,\'b,c\',d',zz}; print qq{[$s]}; ;; $s =~ s{ ( ' [^\\']* (?: \\. [^\\']*)* ' ) } { (my $o = $1) =~ s{,}{-}xmsg; $o; }xmspge; print qq{[$s]}; " [w,ww,'a,bb,ccc,3 ,ee,',4,'a,\'b,c\',d',zz] [w,ww,'a-bb-ccc-3 -ee-',4,'a-\'b-c\'-d',zz]