Perl: HTML::Parser
HTML::Parser
BEGIN { # Create a new package - this could be in MyParser.pm
@ISA=qw(HTML::Parser); # This is how to extend a class...
foreach $key (keys(%$attr)) {
print " $key=$attr->{$key}\n";
} #end of MyParser package
# Create a new MyParser object and parse an HTML file...
$parser->parse_file("test.html");
This example prints out all the tags and their attributes: