in reply to Re: Set the flag
in thread Set the flag

#!/usr/bin/perl use strict; use warnings; my $flag=0; while(<DATA>){ if($flag == 0){ if($_ =~ m/<p>/){ $_ =~ s/<p>/<con>/; $flag=1; } } print $_; } __DATA__ <root> <p>This is para1</p> <p>This is para2</p> </root>
I have tried for the matching first <p>. But in a file how to find the last </p> tag and substitute.
Please help me on this