#!/usr/bin/perl -w use strict;#Always ###the sample line of input my $line = qq*121212, "Simpson, Bart", springfield*; ###capture all quoted strings and place them in @elms my @elms = $line =~ /("[^"]*")/g; ###got through the captures you found in the string $line; for(@elms){ ###make two copies for later use my $original_elm = $_; my $new_elm = $original_elm; ###clean up time $new_elm =~ s/[,"]//g; ###replace the old with the new element. $line =~ s/\Q$original_elm\E/$new_elm/; } my @elements = split(/,/,$line); print "@elements"."\n"; exit; ___OUTPUT___ 121212 Simpson Bart springfield