in reply to Find a Position and Insert Text
So, what code have you already written and how did it fail?
The easiest way in my opinion would be to find the keys where you need to insert the two new structures, and replace them:
use strict; my $str = '{"OWNER":...}'; $str =~ s!"age1"!"scheduled":{"xage1"!; $str =~ s!"age1"!}, "completed":{"xage1"!; $str =~ s!"wc"!}, "wc"!; $str =~ s!"xage1"!"age1"!g;
I've first replaced age1 by xage1 so that on the second replacement, I can use "completed" without undoing my first replacement.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Find a Position and Insert Text
by jlb333333 (Novice) on Mar 16, 2016 at 18:35 UTC |