MeatLips has asked for the wisdom of the Perl Monks concerning the following question:
Here's a question for the wise monks... I have this single line string:
key1=val1 key2=val2 key3=val3 key4="val4a val4b" key5="val5key=(0 1 2 3)" key6=(val6a val6b)I want to parse that into an array so I can have something simple like this:
foreach my $x (@array) { print "$x\n"; }
return the following:
key1=val1 key2=val2 key3=val3 key4="val4a val4b" key5="valkey=(0 1 2 3)" key6=(val6a val6b)
I've been tearing my hair out, poring over various regex texts, trying various ways to use 'split', anything to figure out how to split this pig up the way I want it. What would the wise monks here suggest?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: string parsing with split
by BrowserUk (Patriarch) on Jan 24, 2011 at 20:42 UTC | |
by MeatLips (Novice) on Jan 24, 2011 at 21:27 UTC | |
by BrowserUk (Patriarch) on Jan 24, 2011 at 21:33 UTC | |
by MeatLips (Novice) on Jan 24, 2011 at 22:01 UTC | |
Re: string parsing with split
by ikegami (Patriarch) on Jan 24, 2011 at 20:58 UTC | |
Re: string parsing with split
by AnomalousMonk (Archbishop) on Jan 24, 2011 at 22:27 UTC | |
Re: string parsing with split
by jethro (Monsignor) on Jan 24, 2011 at 20:57 UTC | |
by ikegami (Patriarch) on Jan 24, 2011 at 21:01 UTC |
Back to
Seekers of Perl Wisdom