Hi,

Got a bit of a weird one here, and I can't seem to work it out :(

The code is:
if (length $link->{LatitudLongitud} > 5) { if (!$seen->{$link->{LatitudLongitud}}) { push @{$GoogleMaps::records->{$link->{LatitudLongitud} +}}, $link; $seen->{$link->{LatitudLongitud}} = 1; # make sure we +set this, so we know its been seen already! } else { push @{$GoogleMaps::records->{$link->{LatitudLongitud} +}}, $link; } } if (length $link->{LatitudLongitud02} > 5 && $link->{LatitudLo +ngitud} ne $link->{LatitudLongitud02}) { if (!$seen->{$link->{LatitudLongitud02}}) { push @{$GoogleMaps::records->{$link->{LatitudLongitud0 +2}}}, $link; $seen->{$link->{LatitudLongitud02}} = 1; # make sure w +e set this, so we know its been seen already! } else { push @{$GoogleMaps::records->{$link->{LatitudLongitud0 +2}}}, $link; } }
This should then provide a list of the long/lat values found in the data, and then have an "array" for each of them (even if there is 1 item, or more than 1 with the same long lat values)

However - I was getting an error when trying to pass the array back into a loop, and after looking at Data::Dumper, I saw this:
'13.709931,-89.202365' => [ $VAR1->{'13.704011,-89.247029'}[ +0] ], '13.687479,-89.221301' => [ { 'isPopular' => 'No', 'Curri_Desc18' => '', 'ExpiryNotify' => '0' } ], '13.699487,-89.231086' => [ { 'isPopular' => 'No', 'Curri_Desc18' => '', 'ExpiryNotify' => '0' } ],


Notice the 2nd line:

$VAR1->{'13.704011,-89.247029'}[0]

I can't for the life of me work out thats going on:/

If I change the code to a simple string that gets passed in - then it works as expected (but obviously I don't have the values I need :():
if (length $link->{LatitudLongitud02} > 5 && $link->{LatitudLo +ngitud} ne $link->{LatitudLongitud02}) { if (!$seen->{$link->{LatitudLongitud02}}) { push @{$GoogleMaps::records->{$link->{LatitudLongitud0 +2}}}, "FOO"; $seen->{$link->{LatitudLongitud02}} = 1; # make sure w +e set this, so we know its been seen already! } else { push @{$GoogleMaps::records->{$link->{LatitudLongitud0 +2}}}, "FOO"; } }
Anyone got any suggestions as to whats going on here? I'm at a dead end, and have been trying to work this out for ages now (trying different approaches, etc) ... but nothing seems to be working

TIA!

Andy

In reply to Weirdness with pushing records, and values saved by ultranerds

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.