@row=('aa','bb','\\c\c\','d\d'); $separator=','; foreach (@row) { s/(\\+)/$1$1/g; } print join($separator, @row); print "\n";