How to replace only the first <p> with <con><p> and last </p> with#!/usr/bin/perl use strict; use warnings; while(<DATA>){ $_ =~ s/<p>/<con><p>/g; $_ =~ s/<\/p>/<\/p><\/con>/g; print $_; } __DATA__ <p>This is param1</p> <p>This is second para</p> <p>this is param3</p>
tag is substituted.</p></con><code> <br/> Now all the <code><p>
In reply to search and replace by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |