#!/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);