#!/usr/bin/perl -w use strict; use locale; use warnings; #use diagnostics; use utf8; binmode(STDIN, "encoding(utf8)"); binmode(STDOUT, "encoding(utf8)"); binmode(STDERR, "encoding(utf8)"); use Geo::Coder::Google; my @place = ('Seattle', 'France', 'CorseMétéo', 'NewDelhi'); my ($long, $lat); foreach my $place(@place){ my $geocoder = Geo::Coder::Google->new(apikey => '{MyAPIkeyHere}'); my $response; until (defined $response){ $response = $geocoder->geocode(location => $place); } ($long, $lat) = @{ $response->{Point}{coordinates} }; print "$long\n"; print "$lat\n"; }