Ardii has asked for the wisdom of the Perl Monks concerning the following question:
Hello Monks
I am looking to take in a set of data as a string, comprised of units in the following example format:
[-1,-1,32,45]stored under variable names of the type "$node".
I would then like to search through this string and replace these units with other units of the form:
[1,39,2,45]stored under another variable name "$newnode".
Maintaining the square brackets is critical as this will eventually be used to produce a JSON output. I would ideally like to use the s// approach however any advice would be greatly appreciated.
Many thanks!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Replacement of Bracketed Expressions for JSON output
by ELISHEVA (Prior) on Feb 28, 2011 at 09:09 UTC | |
|
Re: Replacement of Bracketed Expressions for JSON output
by ikegami (Patriarch) on Feb 28, 2011 at 07:20 UTC | |
by Ardii (Initiate) on Feb 28, 2011 at 07:32 UTC | |
by roboticus (Chancellor) on Feb 28, 2011 at 10:55 UTC | |
by ikegami (Patriarch) on Feb 28, 2011 at 17:07 UTC |