Example 2
use WWW::Mechanize;
use Data::Dumper;
my $mech = WWW::Mechanize->new();
$mech->get( "http://google.com" );
my @link;
foreach ($mech->links){
if($_->[0] =~ /foo/){
$mech->get($_->[0]);
}
elsif($_->[0] =~ /bar/){
push @link;
}
}
print Dumper \@link;