Nopes, It is the same The '-' minus sign was my mistake.
I am using this on Red Hat Linux, but I am not the root user. Will not being the root user make any difference? Thanks On Thu, Oct 22, 2009 at 4:33 PM, Philip Potter <philip.g.pot...@gmail.com>wrote: > 2009/10/22 Anant Gupta <anantgupta...@gmail.com>: > > I wrote > > > > #!usr/bin/perl > > use Socket; > > use constant ADDR => 'www.google.com'; > > my $name=shift || ADDR; > > $packed=gethostbyname($name); > > $dotted-inet_ntoa($packed); > > print "DOtted Address is $packed"; > > > > but it is showing an error > > "Bad argument length for Socket length in inet_ntoa" ??? > > Help > > When I run your code, I don't get any such error. Are you sure that > this is the code that produced the error? > > Further: > > $dotted-inet_ntoa($packed); > > did you mean > $dotted = inet_ntoa($packed); > (you used a - minus sign instead of a = assignment operator) > > > print "DOtted Address is $packed"; > > did you mean > print "Dotted Address is $dotted\n"; > you were printing the wrong variable. > > With these changes, I get a dotted ip address which matches the output > of "host www.google.com" > > Philip >