Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

So here the problem, been running perl for a week now. Learning. Cant seem to find answers to my recent WebCrawler compilation errors.

For the next code I get the following errors:

use strict; use IO::Socket; use local::lib; print("Welcome to my webcrawler, \n Please specify a url in the following format : www.xxx.y \n"); chomp(my $yourURL=<STDIN>); my $sock = new IO::Socket::INET ( PeerAddr => '$DSTaddress', PeerPort => '80', Proto => 'tcp', ); die "Could not create socket: $!\n" unless $sock; print (“TCP Connection Success. \n"); send($sock,"GET http:$yourURL HTTP/1.0\n\n",0); @response=<SOCKET>; print("@response");

Unrecognized character \x93 marked by <-- HERE after print <<-- near column 8 at C:Users\Users\Desktop\Crawlertst1.pl line 19

What would that error mean? Looked it up at google, seems go on about some encoding problems. A day ago there was no encoding bugs on compilation.

Replies are listed 'Best First'.
Re: Help with my Crawler
by moritz (Cardinal) on Mar 08, 2011 at 09:28 UTC
Re: Help with my Crawler
by Corion (Patriarch) on Mar 08, 2011 at 09:28 UTC

    You have a "smart quote" where Perl does not expect one. Get a decent editor and only ever use ASCII characters in your code:

    print (“TCP Connection Success. \n"); # wrong print ("TCP Connection Success. \n"); # right

    Also, Perl tells you the line number and column where it found the error. What part of that information did you have problems with?

      What would be a better editor? Im just coding in text editor, saving it as .pl and running through cmd.

        I don't know what operating you are using, and what the "text editor" is there. Depending on your operating system, there are likely many good choices. Personally, I like Padre. I also often use vi. Windows users also seem to like Notepad++, but I've never used it myself.

Re: Help with my Crawler
by ikegami (Patriarch) on Mar 08, 2011 at 09:31 UTC
    I didn't know internet addresses could start with dollar sign...
    PeerAddr => '$DSTaddress', # The string "$","D","S",...
    should be
    PeerAddr => $DSTaddress, # The contents of the var
Re: Help with my Crawler
by JavaFan (Canon) on Mar 08, 2011 at 12:33 UTC
    Note that you could do the same with wget wrapped in a trivial shell script:
    #!/usr/bin/sh DSTaddress=www.example.com echo "Welcome ..." read URL wget -qO- http://$DSTaddress/"$URL"
    Of, if you insist in using Perl, using LWP::Simple.