Link to home
Start Free TrialLog in
Avatar of wally_davis
wally_davisFlag for United States of America

asked on

Using/Learning "Eclipse IDE for Java Developers" to write Perl. Error in one line of code. Looks OK syntactically.

Here's my VERY simple line of code (with error). This should be a no brainer but I've just setup Eclipse version 4.6.2 (Build 20161208-0600) and it's all new to me. It also appears that the escaping the forward slashes weren't needed either as that didn't work. :)

--- CODE Begin ---
use strict;
use warnings;

use LWP::Simple;

sub main {
    print get("http://www.SomeWebsiteThatWorks.com/"); <-- ** Error = Use of uninitialized value in print at (line of code or this line). **
}

main();
--- CODE Ends ---

Thanks!
Avatar of wesly_chen
wesly_chen
Flag of United States of America image

It suggests get() return value has to be defined,

my $stuff =  get("http://www.SomeWebsiteThatWorks.com/");
die "Couldn't get it!" unless defined $stuff;
print $stuff
Avatar of wally_davis

ASKER

Well, I'm one step closer now. I used http://www.lpi.org as the URL but it comes back with "Couldn't get it! at (line of code failing).

Is it possible that since I'm behind a Proxy at my company, that I need to add a Proxy string of sorts to allow the request to go through?
If your browser need to setup proxy to read http://www.lpi.org/, then you might need to use proxy  to get the content of lpi.org in perl.
I've no proxy at my side, I can not test for it.
This question needs an answer!
Become an EE member today
7 DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.