Sprad has asked for the wisdom of the Perl Monks concerning the following question:
foo:a,bar:a,b,c,baz:d
This should result in the following array, which I can then process further as needed:
foo:a bar:a,b,c baz:d
I could do this with a two-pass method, where first I do a substitution like this:
s/,(\w+):/MONKEYBUTT$1:/g;
and then split on /MONKEYBUTT/ (or some other unlikely string).
But is there a more elegant solution that wouldn't offend our simian friends?
---
A fair fight is a sign of poor planning.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Double-duty commas
by Jasper (Chaplain) on Feb 25, 2005 at 17:30 UTC | |
Re: Double-duty commas
by ikegami (Patriarch) on Feb 25, 2005 at 17:33 UTC | |
Re: Double-duty commas
by Enlil (Parson) on Feb 25, 2005 at 17:34 UTC | |
Re: Double-duty commas
by Fletch (Bishop) on Feb 25, 2005 at 18:07 UTC |