#!/usr/bin/perl use strict; use warnings; print '<con>'; my $out; while(<DATA>){ $out .= $_; } chomp($out); print "$out</con>\n"; __DATA__ <p>This is param1</p> <p>This is second para</p> <p>this is param3</p>
Do you mean replace the first p-tag in all DATA, or the first p-tag on each line? Ditto for last.
If you did mean by line, step 1 is to drop the 'g' from your regexes.
In reply to Re: search and replace
by keszler
in thread search and replace
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |