#!/usr/bin/perl use strict; use warnings; use Geo::IP; my $gi = Geo::IP->open("/usr/share/GeoIP/GeoIPCity.dat", GEOIP_STANDARD); my $ip = shift; my $record = $gi->record_by_addr($ip); print join "\n", $record->country_code, $record->country_code3, $record->country_name, $record->region, $record->region_name, $record->city, $record->postal_code, $record->latitude, $record->longitude, $record->time_zone, $record->area_code, $record->continent_code, $record->metro_code;