Re: Convert Site Name to Dotted IP Address

2009-10-22 Thread John W. Krahn
Anant Gupta wrote: 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" ???

Re: Convert Site Name to Dotted IP Address

2009-10-22 Thread Shlomi Fish
Hi Anant! Here's some review of your code: On Thursday 22 Oct 2009 12:23:55 Anant Gupta wrote: > I wrote > > #!usr/bin/perl > use Socket; 1. You should add "use strict;" and "use warnings;" at the top of every file. Writing programs without them is dangerous. Probably the only instance where

Re: Convert Site Name to Dotted IP Address

2009-10-22 Thread Philip Potter
2009/10/22 Anant Gupta : > Thank you. > I just used "use strict" and "use warnings" and it worked. > Even now I cant figure out what difference can this make :) > > Thank you for tour time If it helps, I have no idea either :) Philip -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For

Re: Convert Site Name to Dotted IP Address

2009-10-22 Thread Anant Gupta
Thank you. I just used "use strict" and "use warnings" and it worked. Even now I cant figure out what difference can this make :) Thank you for tour time Anant On Thu, Oct 22, 2009 at 5:19 PM, Philip Potter wrote: > 2009/10/22 Anant Gupta : > > Nopes, > > It is the same > > > > The '-' minus si

Re: Convert Site Name to Dotted IP Address

2009-10-22 Thread Philip Potter
2009/10/22 Anant Gupta : > 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? No, it won't make any difference. This is probably quite frustrating for you, but I'm not

Re: Convert Site Name to Dotted IP Address

2009-10-22 Thread Anant Gupta
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 wrote: > 2009/10/22 Anant Gupta : > > I wrote > > > > #!usr/bin/perl >

Re: Convert Site Name to Dotted IP Address

2009-10-22 Thread Philip Potter
2009/10/22 Anant Gupta : > 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

Convert Site Name to Dotted IP Address

2009-10-22 Thread Anant Gupta
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