Dear monks

I get the error Undefined Subroutine &main::get called at Webcrawler.pl line 38, <STDIN> line 1. The code is below:

#!/usr/bin/perl use strict; #Module used to go through the web pages, Can extract links, save them + and also strip the HTML of its contents use WWW::Mechanize; use HTML::TreeBuilder; 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 = <STDIN>; # The user inputs the URL to be searched #Grab the contents of the URL given by the user $webcrawler = get($url_name);

There is more code in the program but i don't think it matters. Line 38 is the $webcrawler = get($url_name); line. Also, the <STDIN> is not on line 1 which buffles me too, i have quite a few comments written at the start and the my $url_name = <STDIN>; bit is line 35. I thought the problem here was because i didn't have installed the LWP::Simple module but i do have it after all. Any ideas?Thanks


In reply to Subroutine &main::get error by lampros21_7

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.