Thanks that probably explains my higher than expected ungeocoded rate. Two weeks of playing with perl and I feel like I know less than when I started.


On Feb 25, 2010, at 3:31 AM, "Jenda Krynicky" <je...@krynicky.cz> wrote:

From: Erik Lewis <ele...@ngrl.org>
<snipped>
print "Enter your address\n";

chomp (my $rawaddress = <>);

my $geoaddress = $rawaddress =~ s/ /\+/;
#strip the spaces from the address

my $googlekey = "ABQIAAAAJKeZa28YtErALcrbEC0UlBREf5oWR6F07BQvSEe3pww8R4s0VhTfTt- 19vTI9qA-_V1pUf4-_TcfpQ";
#get your google http://code.google.com/apis/maps/signup.html

my $geocode_csv = get("http://maps.google.com/maps/geo?q=$geoaddress&output=csv&sensor=false&key=$googlekey ")
or die 'Unable to get page';
<snipped>

As if I did not think so. No you do not need to replace spaces by
plus signs! You need to escape the string for inclusion in a query
string!

use CGI::Enurl qw(enurl);
my $geoaddress = enurl($rawaddress);

or

use URI::Escape qw(uri_escape);
my $geoaddress = uri_escape($rawaddress);


Jenda
===== je...@krynicky.cz === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed
to get drunk and croon as much as they like.
   -- Terry Pratchett in Sourcery


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to