$m = WWW::Mechanize->new(); $m->get($url); # $url is some home page @links = $m->links(); for $link ( @links ) { &follow; } sub follow { if ($m->follow_link( url_regex => qr/contact/i)){ print "$link->url\n"; } }