You can do away with Socket and that binary conversion
by just using the 4-byte raw data:
#!/usr/bin/perl
use strict;
for my $host (@ARGV) {
my $addr = gethostbyname($host);
my $sum = 0;
$sum = $sum * 256 + ord for split //, $addr;
print "$host: $sum\n";
}