TASdvlper has asked for the wisdom of the Perl Monks concerning the following question:
I'm a little stumped. I have the following string:
And I want to split on the comma but I don't want to split on the comma if there is a space(s) after it. So, basically, I want the elements in my array to be:my $str = "CONFIGURATION,Validate C++ CLI Common Syntax (-h, -m, -np, +-p, -t, -q, -v, -ncr, CMD) via ndu -status on CX700,test-dvlp,yes"
element 0: CONFIGURATION
element 1: Validate C++ CLI Common Syntax (-h, -m, -np, -p, -t, -q, -v, -ncr, CMD) via ndu -status on CX700
element 2: test-dvlp
element 3: yes
Is there some way of combining a regexp with the split command ?
Any help would be greatly appreciated.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: A question on splitting
by ysth (Canon) on Jan 14, 2004 at 20:40 UTC | |
by TASdvlper (Monk) on Jan 14, 2004 at 21:10 UTC | |
by Abigail-II (Bishop) on Jan 14, 2004 at 21:17 UTC | |
by ysth (Canon) on Jan 14, 2004 at 22:14 UTC | |
|
Re: A question on splitting
by mpolo (Chaplain) on Jan 14, 2004 at 20:44 UTC | |
by ysth (Canon) on Jan 14, 2004 at 21:08 UTC | |
by duff (Parson) on Jan 14, 2004 at 21:10 UTC |