in reply to substitution issue

I find your indenting style confusing as well as problem statement. However, this appears to meet your requirements.

#!/usr/bin/perl -w use strict; while (<DATA>) { if (m|^\s*\<Content\>| ... m|^\s*\<\/Content\>|) { s/(\^M)+/\^M/g; #compress multiple ^M to one s/(\^M)/&lt;br\/>&gt/g; print $_ unless m|\<.?Content\>|; # don't print <Content> # or <\Content> lines } } =pod THE ABOVE CODE PRINTS: Some of the week's top stories:&lt;br/>&gt EASTON AREA&lt;br/>&gt BETHLEHEM AREA&lt;br/>&gt CARBON, SCHUYLKILL AND REGION&lt;br/>&gt have charged his mother's boyfriend, Paul Hoffman, with third-degree m +urder. Officials said the charges were filed after an exhaustive inve +stigation that showed Miller, who died Sept. 25, had the mental capac +ity of a 12-year-old.&lt;br/>&gt =cut __DATA__ <ID>^M <Number>124^M</Number>^M <Content> Some of the week's top stories:^M EASTON AREA^M BETHLEHEM AREA^M CARBON, SCHUYLKILL AND REGION^M^M have charged his mother's boyfriend, Paul Hoffman, with third-degree m +urder. Officials said the charges were filed after an exhaustive inve +stigation that showed Miller, who died Sept. 25, had the mental capac +ity of a 12-year-old.^M </Content> ^M ^M ^M ^M ^M ^M