Hi there, been struggling with getting the coordinates out of the Geo::Coder::Google V3. When I dump the call results I get:
$VAR1 = { 'formatted_address' => 'Huoben 2, 6023 Rothenburg, Schweiz', 'types' => [ 'street_address' ], 'address_components' => [ { 'types' => [ 'street_number' ], 'short_name' => '2', 'long_name' => '2' }, { 'types' => [ 'route' ], 'short_name' => 'Huoben', 'long_name' => 'Huoben' }, { 'types' => [ 'locality', 'political' ], 'short_name' => 'Rothenburg', 'long_name' => 'Rothenburg' }, { 'types' => [ 'administrative_area_level_2', 'polit +ical' ], 'short_name' => 'Hochdorf', 'long_name' => 'Hochdorf' }, { 'types' => [ 'administrative_area_level_1', 'political' ], 'short_name' => 'LU', 'long_name' => 'Luzern' }, { 'types' => [ 'country', 'political' ], 'short_name' => 'CH', 'long_name' => 'Schweiz' }, { 'types' => [ 'postal_code' ], 'short_name' => '6023', 'long_name' => '6023' } ], 'geometry' => { 'viewport' => { 'southwest' => { 'lat' => '47.0860081197085', 'lng' => '8.2563233197085' }, 'northeast' => { 'lat' => '47.0887060802915', 'lng' => '8.2590212802915' } }, 'location' => { 'lat' => '47.0873571', 'lng' => '8.2576723' }, 'location_type' => 'ROOFTOP' } };
I am trying to extract the latitude and longitude with:
my $long = $location->{'geometry'}{'viewport'}{'location'}{'lng'}; my $lat = $location->{'geometry'}{'viewport'}{'location'}{'lat'};
Which is giving me no results. Can anyone help me with this please? Many Thanks!

In reply to Google decoder by bkerr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.