my $bla = qq+The quick brown fox jumps over the lazy dog. The quick br
+own fox jumps over the lazy dog. The quick brown fox jumps over the l
+azy dog. The quick brown fox jumps over the lazy dog. The quick brown
+ fox jumps over the lazy dog. The quick brown fox jumps over the lazy
+ dog.
<list>The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog.</list>
The quick brown fox jumps over the lazy dog. The quick brown fox jumps
+ over the lazy dog. The quick brown fox jumps over the lazy dog. The
+quick brown fox jumps over the lazy dog. The quick brown fox jumps ov
+er the lazy dog. The quick brown fox jumps over the lazy dog.+;
$bla =~ s~(<list>)(.*?)(</list>)~$1.subst($2).$3~es;
print $bla;
sub subst{
my ($string) = @_;
print $string;
my $res = "";
for(split(/\n/,$string)){
$res .= '<item>'.$_.'</item>'."\n";
}
return $res;
}