#!C:/Perl/bin/perl.exe use strict; use warnings; use HTML::TokeParser::Simple; my $html = q{ }; my $p = HTML::TokeParser::Simple->new(\$html); my $in_anchor; while (my $t = $p->get_token){ if ($t->is_start_tag('a')){ $in_anchor++; next; } if ($t->is_start_tag('img') and $in_anchor){ my $src = $t->get_attr('src'); print "$src\n"; $in_anchor = 0; } } #### an_image.jpg