#!usr/bin/perl use strict; use warnings; my $input = do{local $/; <DATA>}; $input =~ s|(<p>)|<con>\n$1|; $input =~ s|(.*</p>)|$1\n</con>|s; print $input; __DATA__ <root> <p>This is para1</p> <p>This is para2</p> <date>Wednesday, October 28, 2009</date> </root>
<root> <con> <p>This is para1</p> <p>This is para2</p> </con> <date>Wednesday, October 28, 2009</date> </root>
In reply to Re^3: Set the flag
by wfsp
in thread Set the flag
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |