How to add <p> at the end of NEW and delete#!/usr/bin/perl while(<DATA>){ if (/^(\[\w+\])/) { $f = $1; } elsif ($f =~ m/\[NEW\]/) { $_ =~ s/\[NEW\](.*){\w*}/<p>$1<\/p>/g; $_=~ s/<$/<\/p><p>/g; print $_; } } __DATA__ [NEW] Dear Carolyn: My husband and I divorced after 42 years. It didn't tak +e 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 the +ir grandmother.< [OLD]
tag before the start of '['
In reply to Add tag by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |