in reply to Passing other variables to start handler in HTML::Parser

HTML::Parser is a generic module, and it now passes all what it can get from html file to you, it is good enough already, the rest would rely on you. The door is always open, if you want to sub class HTML::Parser, but don't think it is a good idea here.

use HTML::Parser; sub handle_img { my $attr = shift; if ($attr->{"src"} eq "perlmonks") { print "Oh, a monk\n"; } else { print "Who are you?\n"; } } sub start { my ($self, $tagname, $attr) = @_; if (lc($tagname) eq "img") { handle_img($attr); } } $p = HTML::Parser->new(start_h => [\&start, "self, tagname, attr"]); $p->parse_file("a.html");