develooper Front page | perl.beginners | Postings from October 2009

Convert Site Name to Dotted IP Address

Thread Next
From:
Anant Gupta
Date:
October 22, 2009 03:24
Subject:
Convert Site Name to Dotted IP Address
Message ID:
71ad6a0910220323g6f640a6dm1e771e030da33f9f@mail.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

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About