in reply to Darn Hash refs

Can't use string ("") as a HASH ref while "strict refs" in use at 7603 +86.pl line 40 (#1) (F) Only hard references are allowed by "strict refs". Symbolic references are disallowed. See perlref.
Line 40 is     my $check = $token->[2]{name};, and you're assuming $token->[2] is defined, and its a hashref (this is only true if $token is a Start tag). HTML::TokeParser::Simple might be easier to work with. Also see diagnostics,strict, perlref.