Попробуйте:
use strict;
use warnings;
use Text::ParseWords;
while (<DATA>) {
chomp;
my @f = quotewords ',', 0, $_;
for (@f) {
s/^\s*|\s*$//g;
s/^/"/ && s/$/"/ if /,/;
}
print join (",", @f), "\n";
}
__DATA__
2011-03-09,4919 1281 0410 9930,55107,SAZB2314,"John, Doe" ,1-888-888-4452 ext 1813
"ashish", "kumar", "test,1", "test2"
"foo", "b,ar", "msg1", "msg2"