in reply to How to do with this hash?

A comment on the last part of your code (from the 'foreach' onward) - it would be much more efficient to assign long country names like this:
$CountryName = $CountryCode{$Country} || undef;
This takes advantage of the lookup capabilities of hashes.

I'll be back in a minute with some more code... Here ya go:

#!/bin/perl -w use strict; use Socket; my $ip_addr = '207.127.235.77'; my $remote_host = gethostbyaddr(inet_aton($ip_addr),AF_INET); # get ww +w.xxx.xxx.uk my %CountryCode = ( 'com','Comercial', 'uk','The United Kingdom' ); # a hash of country names my @CCode = split /\./, $remote_host; # split every portion my $Country = $CCode[-1]; # get the last my $CountryName = $CountryCode{$Country} || "Country Unknown"; print $CountryName;

___ -DA > perl -MPOSIX -le '$ENV{TZ}="EST";print ctime(1000000000)' Sat Sep 8 20:46:40 2001