#!/usr/bin/perl use strict; use warnings; use Data::Dumper; use LWP::Useragent; use LWP::Debug qw(- +conns); use WWW::Mechanize; my $total_count = 0; my @keywords = ('simpsons', 'diehard', 'fantastic+four', ); foreach my $keywords(@keywords){ my $url ='http://news.google.co.uk/search?q=~%22'.$keywords.'%22&num=100&hl=en&safe=off&start=0&as_qdr=all&filter=0'; my $mech = WWW::Mechanize->new(); $mech->proxy('http','127.0.0.1:8088'); $mech->get($url); print $mech->uri."\n"; my @links_to_check = grep { $_->url() !~ /google/i} $mech->find_all_links( url_regex => qr/\./i ); foreach my $links_to_check (@links_to_check) { $total_count++; print "$links_to_check \n"; } } print " $total_count news items found \n";