#! /usr/bin/perl use strict; use warnings; use HTML::Parser; my @images; my $string = qq~xxxxxxxx ~; my $p = HTML::Parser->new(); $p->handler(start => \&start_handler,"tagname,attr,self"); $p->parse($string); print $_,"\n" for(@images); sub start_handler{ return if(shift ne 'img'); push(@images,shift->{src}); }