in reply to parsing a multi-line pattern and replacing
Here's how you would select the information you want. I'll leave it as an exercise to modify the code to replace the values.
#!/usr/bin/perl -w use strict; my $wholefile = ''; while(<DATA>) { $wholefile .= $_; } while($wholefile=~m/\<default\>([^\>]+)\<\/default\>/gs) { print qq~$1\n~; } 1; __END__ this is line 1 this is line 2 <default>sometext</default> this is line 3 <default>some more text some more in next line </default> this is last line
Prints...
sometext some more text some more in next line
Celebrate Intellectual Diversity
|
|---|