Hi everybody,
I am using this code to disply the first level p tags for this i used regex but i am getting p's but not data can any one help me to solve this. My code is:
se strict;
my
@p={};
my $p="";
my $count=1;
my $index=0;
my $x="";
my $y="";
my $str='< body > < p > one< p >one-one< /p > < a >h< /a > < /p > < p > two < /p >< p >three< /p >< /body >';
@p=($str=~ /<(p)>.*?(<\1[^<>]*>.*?<\/\1>)*.*?<\/\1>/gi);
$p=
@p;
print
@p ."\n";
foreach $p (
@p){
print "$count--->$p \n";
$count++;
}
I am getting output like:---
6
1--> p
2-->
3-->p
4-->
5--> p
6-->
But i want output like:
one
two
three