my $inlist = 0; while(<>) { chop; if ( $inlist ||= /^(\<list\>)(.*)$/ ) { print "$1<item>"; $_=$2; } $inlist &&= !( /^(.*)(\</list\>)$/ and print "$1</item>" and $_=$2 ); print "$_\n"; }
-M
Free your mind
In reply to Re: Regex to replace a particular part of content
by Moron
in thread Regex to replace a particular part of content
by rsriram
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |