You can make this problem easier to solve by switching to HTML::TokeParser::Simple. (Disclaimer: I wrote it)
use strict; use HTML::TokeParser::Simple; my $p = HTML::TokeParser::Simple->new(shift||die); while (my $token = $p->get_token) { print $token->return_attr('href'), "\n" if $token->is_start_tag('a'); }
Note that the module is a drop-in replacement for HTML::TokeParser. If you switch to it, your code will function exactly the same and you can simply rewrite the messy bits.
Cheers,
Ovid
New address of my CGI Course.
In reply to Re: HTML::Tokeparser and $attr problem
by Ovid
in thread HTML::Tokeparser and $attr problem
by dannoura
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |