use strict; use HTML::PullParser; my $p = HTML::PullParser->new( file => shift @ARGV, start => 'tagname, @attr' ); while(my $t = $p->get_token()) { my($tagname, %attr) = @$t; print "alt text is $attr{alt}", $/ if exists $attr{alt}; }