Anthony Beaman wrote:
> 
> Hi! I have version 5.005_03 and I'm using the Win32 version of the Learning Perl 
>book. I'm having trouble running a few scripts. For example, when I run the following:
> 
> Exercise 16.1
> 
> foreach $host (@ARGV) {
>   ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($host);
>   print "$host:\n";
> 
>   foreach $a (@addrs) {
>     print join(".", unpack("C4", $a)), "\n";
>   }
> }
> 
> ....I get the following errors:
> 
> Name "main::name" used only once: possible typo at 415.pl line 5.
> Name "main::length" used only once: possible typo at 415.pl line 5.
> Name "main::aliases" used only once: possible typo at 415.pl line 5.
> Name "main::addrtype" used only once: possible typo at 415.pl line 5.
> 
> What am I doing wrong? The scripts in the book are supposedly for
> this version but I'm having trouble with this and similar scripts.
> Also, I cannot get the "IO::Sockets::INET->new" line to work in any
> of my scripts to run ("Unknown Error"). Any advice? Thanks! :-)


Change this line

   ($name, $aliases, $addrtype, $length, @addrs) = gethostbyname($host);

To

   (undef, undef, undef, undef, @addrs) = gethostbyname($host);



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to