http://qs321.pair.com?node_id=556894


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