|There's more than one way to do things|
split on commasby pip9ball (Acolyte)
|on Jun 05, 2009 at 17:33 UTC||Need Help??|
pip9ball has asked for the
wisdom of the Perl Monks concerning the following question:
I have the following string:
my $string = "<*2>FOO<2,1>,<*3>(SigB<8:0:2>,BAR),<*2>Siga<2:0>,Sigb<8,7,6,5,0>";
I need a way to split on commas, but not the commas inside
'<>' or '()' characters
What I've been trying to do is first replace all commas
inside the '<>' and '()' with '|||', then to the split on commas,
followed by another replacement of '|||' to commas.
Is there a better way to do this?