#!/usr/bin/perl while(){ if (/^(\[\w+\])/) { $f = $1; } elsif ($f =~ m/\[NEW\]/) { $_ =~ s/\[NEW\](.*){\w*}/

$1<\/p>/g; $_=~ s/<$/<\/p>

/g; print $_; } } __DATA__ [NEW] Dear Carolyn: My husband and I divorced after 42 years. It didn't take long for him to find a replacement, but I was happy for him at the time.< them and let my grandchildren dig through her purse as if she were their grandmother.< [OLD]