Untested, but you can simplify that while loop and make it easier to read by switching to HTML::TokeParser::Simple:
while ( my $tag = $tp->get_token ) { next unless $tag->is_start_tag($s_tag) and ($tag->get_attr($s_attrb) || '') eq $s_value and ++$start; last if $tag->is_end_tag($e_tag); if ($tag->is_start_tag('a') && $tag->get_attr('href')) { $data{$tag->get_attr('href')} = $tag->get_trimmed_text('/a'); $count++; last if $count == $max; } }
I may have missed some particulars, but you can see how the code is easier to read.
Cheers,
Ovid
New address of my CGI Course.
In reply to Re^2: HTML::Parser API script or module
by Ovid
in thread HTML::Parser API script or module
by ldln
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |