in reply to Regex to replace a particular part of content
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 Section
Seekers of Perl Wisdom