foreach (@rows) { s/\t/\x09/ig; s/\n/\x0A/ig; s/\r/\x0D/ig; s/"/'/ig; print FILE qq{"$_",}; # Other delimiters too. $cell++; }