#!/usr/bin/perl use strict; use warnings; my @res= SplitCSVLine('123,hubba hubba,bla fasel,hell'); print ':',join":",@res,":\n"; #### :123:hubba hubba:bla fasel:hell:: #### $line =~ s/\"((\"\"|[^\"])*)\"\s*(,|$ )//x;