#!/usr/bin/perl use strict; use warnings; use HTML::Parser; use File::Find; use Data::Dumper; my $hp= HTML::Parser->new( api_version => 3, start_h => [ \&start, 'tag,attr' ], # This should call, for every start tag the start subroutine # passign the tagname and a reference to the attribute hash ); find( sub { return unless /\.html?$/; find_embed( $_ ); # in find_embed I will invoke the parser }, @ARGV) if scalar(@ARGV); sub find_embed { my($filename)= @_; $hp->parse_file( $filename ); # Now the parser is started } sub start { my($tag, $attr)= @_; return unless $tag eq 'embed'; # ignore every tag but embed print Dumper($attr); # Dump the attributes. }