#!/usr/bin/perl

use IP::World;
my $ipw = IP::World->new(0);

sub showCountryCode {
  $_ = shift;
  if ( /((\d+)\.(\d+)\.(\d+)\.(\d+))/ ) {
    print "$1 -> $ipw->getcc($1)\n";
  }
}

if ($#ARGV == 0) {
  showCountryCode($ARGV[0]);
} else {
  while(my $ip = <>) {
    showCountryCode($ip);
  }
}
