in reply to Splitting a line on just commas

Text::CSV_XS. The typical usage is in the synopsis.

Replies are listed 'Best First'.
Re^2: Splitting a line on just commas
by reddydn (Initiate) on Jun 14, 2010 at 17:15 UTC
    @arr = split /(".+?")|,/, $s print @arr a b "hey,you" "str1, str2, str3" end
      That doesn't work. It actually returns
      ( 'a', undef, 'b', undef, '', '"hey, you"', '', undef, '', '"str1, str2, str3"', '', undef, 'end', )

      Keep in mind the first arg of split is a separator.