|
|
|
Clear questions and runnable code get the best and fastest answer |
|
| PerlMonks |
parse string containing spaceby mtovey (Initiate) |
| on May 01, 2015 at 03:50 UTC ( [id://1125328]=perlquestion: print w/replies, xml ) | Need Help?? |
|
mtovey has asked for the wisdom of the Perl Monks concerning the following question: So, this is yet another string parsing question that has probably been asked before, but I am so far unable to find a solution. I have a string that looks like the following:
I need a loop that will break each pair into two scalars, $name and $value, and process them. The killer for me is the "name2=' value2'" pair. I need that leading space for value2 to be included into $value. So far I am ending up with $name set to "name2" and $value set to "'" during one iteration of the loop, and $name set to "vlaue2" and $value set to "0'" during the next iteration. What I am expecting is $name set to "name2" and $value set to " value2=0" during one iteration. I assume that a regular expression can be written for this, but my perlre is pretty thin right now. Any help will be greatly appreciated! -Mark
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||||