sub csv_split { local $_ = shift || return undef; my @array; my $count = my $quoted = 0; while ( s/(.)// ) { if ( $1 eq ',' and !$quoted ) { $count++; } elsif( $1 eq q/"/ ) { $quoted = 1 - $quoted unless $quoted and s/^\"//; } else { $array[$count] .= $1; } } return @array; }