use strict; use IO::File; use HTML::Parser; # version 3.15, by the way # get the contents of the HTML file my $fh = new IO::File('google.html'); my $html = do {local $/; <$fh>}; my $parser = HTML::Parser->new(api_version => 3); $parser->handler(start => \&start, 'self,tagname,attr'); $parser->parse($html); sub start { my ($parser,$tag,$attr) = @_; return unless $tag eq 'img'; # insert code to process the image file print $attr->{src}, "\n"; }