my @a; while( my @temp = split ',', ) { push @a, \@temp } print "@$_" for @a;; a,b,c e,f,g 1,2,3 ^Z a b c e f g 1 2 3