in reply to Re: split on commas
in thread split on commas
This does not work for some strings.
$string = "(1,2,3,<4,5,6>),more"; my @line = split(/,(?![\w,]+[>)])/, $string); print Dumper(\@line);
produces
$VAR1 = [ '(1', '2', '3', '<4,5,6>)', 'more' ];
The problem is any commented comma that is followed by an opening delimiter before a closing delimiter. I suspect it is not possible to generalize the solution without counting the delimiters.
|
|---|