use WWW::Mechanize; use URI; print "WEB CRAWLER AND HTML EXTRACTOR \n"; print "Please input the URL of the site to be searched \n"; print "Please use a full URL (eg. http://www.dcs.shef.ac.uk/) \n"; #Create an instance of the webcrawler my $webcrawler = WWW::Mechanize->new(); my $url_name = ; # The user inputs the URL to be searched 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); # Put the links that exist in the HTML of the URL given by the user in an array my @website_links = $webcrawler->links($uri); # The HTML is stripped off the contents and the text is stored in an array of strings my $x = 0; my @stripped_html; $stripped_html[$x] = $webcrawler->content( format => "text" ); print $stripped_html[$x];