#!/usr/bin/perl use strict; use warnings; my $tmp = 'SmcRel30Storyr'; use HTML::Parser; my $parser = HTML::Parser->new( start_h => [ \&gethref,"tag,attr" ]); $parser->parse($tmp); sub gethref { my ( $tag, $attribs) = @_; if ( $tag eq 'a' && exists $attribs->{href} ) { if ( $attribs->{href} =~ /SmcRel30Story/ ) { print $attribs->{href}; } } }