dear all,
I didn't understand how to use the module HTML, but I need to count how
many tags of several types appear in a web page and so I wrote this
script.
Someone can tell me why this one doesn't work?
%tags = ("paragraph" => "p",
"list_o" => "ol",
"list_no" => "ul",
"title" => "h1",
"ltl_title" => "h2|3|4|5",
"link" => "href");
while(<$filename>)
{
foreach $var (keys(%tags))
{
$$var += count_it($$var, $var, $tags{$var},$_);
}
}
foreach $var(keys(%tags))
{
print STDOUT "$var: $$var $br\n";
}
sub countit
{
$actual = shift();
$descrizione = shift();
$tag= shift();
LOOP: if(/<$tag[^>]*>/)
{
$actual++;
s/<\/?$tag[^>]*>//;
goto LOOP;
}
return $actual;
}
|^|_|^|_|^| |^|_|^|_|^|
| | | |
| | | |
| |*\_/*\_/*\_/*\_/*\_/* | |
| |
| |
| |
| http://www.e-allora.net |
| |
| |
**************************************
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>