Let's look at your code line-by-line...
use strict; # good use warnings; # good use Net::Whois::IP qw(whoisip_query); # I can't test as I don't have the Net::Whois::IP # module installed use Data::Dumper; # Here is a module you invoke but from which you don't # call anything, at least in this example. &whois(); # why do you call this with no params # and use lexicals form the $main:: # package within it? This is not # directly related to your problem, but # is bad form. You also call it in void # context even though you make it return # values... my ($ip, $email, $techname); # The above call returns things that are not # declared until here. Think about what my() will # do to these variables at this point in the program. print "$ip\'s name is $techname and email address is $email\n"; # There's a concatenation done here. Is this # the line that complains? Why would these variables # not be initialized? sub whois{ $ip = '149.1.1.1'; my ($response,$array_of_responses) = whoisip_query($ip); $email = $response->{TechEmail}; $techname = $response->{TechName}; return ($email, $techname); # Here you return something # which your main program # is throwing away because # the sub is called in # void context. ####!!! There should be a closing curly for this sub!!!
I can't test anything right now because I don't have the time to install Net::Whois::IP for just a test. However, let's see if you get the same error with the following code. Even if you do, it may be easier to track down.
use strict; use warnings; use Net::Whois::IP qw(whoisip_query); use Data::Dumper; my ($ip, $email, $techname); $ip = '149.1.1.1'; ( $email, $techname ) = whois($ip); print "$ip\'s name is $techname and email address is $email\n"; sub whois { my $addr = shift; my ($response,$trash) = whoisip_query($addr); $email = $response->{TechEmail}; $techname = $response->{TechName}; return ($email, $techname); }


Christopher E. Stith

In reply to Re: Help With Net::Whois::IP by mr_mischief
in thread Help With Net::Whois::IP by Dru

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.