my $x = 0; # Would be at the top before the loop
my @stripped_html;
$stripped_html[$x++] = $webcrawler->content( format => "text" );
# Loop back get more URLS and keep processing.
map { print $_,$/; } @stripped_html
####
GoogleWebááááImagesááááGroupsááááNewsááááFroogleááááLocaláááámoreá╗áááAdvanced S
earchááPreferencesááLanguage ToolsAdvertisingáPrograms - Business Solutions - Ab
out Google⌐2005 Google - Searching 8,058,044,651 web pages
####
$mech->links()
When called in a list context, returns a list of the links found in the last fetched page. In a scalar context it returns a reference to an array with those links. Each link is a WWW::Mechanize::Link object.
####
#!/usr/bin/perl -w
use WWW::Mechanize;
use URI;
print "WEB CRAWLER AND HTML EXTRACTOR \n";
#Create an instance of the webcrawler
my $webcrawler = WWW::Mechanize->new();
my $url_name = "http://www.google.com";
my $uri = URI->new($url_name); # Process the URL and make it a URI
#Grab the contents of the URL given by the user
$webcrawler->get($uri);
die "Failed\n" unless $webcrawler->success(); # Check for return status
# links() retuns a Link object.
map { print ($_->url(),"\n"); } $webcrawler->links($uri);
####
WEB CRAWLER AND HTML EXTRACTOR
/imghp?hl=en&tab=wi&ie=UTF-8
http://groups-beta.google.com/grphp?hl=en&tab=wg&ie=UTF-8
/nwshp?hl=en&tab=wn&ie=UTF-8
/frghp?hl=en&tab=wf&ie=UTF-8
/lochp?hl=en&tab=wl&ie=UTF-8
/intl/en/options/
/advanced_search?hl=en
/preferences?hl=en
/language_tools?hl=en
/ads/
/intl/en/services/
/intl/en/about.html