So, this doesn't work, and I have no idea why. I've tried every possible variation. But nothing works. I'm ready to take a chainsaw to my server, but hopefully you can prevent that:
sub getQuestMarkers {
#database stuff
...
my %package;
while(my ($key, $lat, $lng) = $sth->fetchrow_array()) {
$package{$key} = ($lat,$lng);
}
...
return %package;
}
my %markers = getQuestMarkers();
while(my( $key, $value) = each %markers) {
print "$key: @value - $value[0] $value[1]\n";
}
perldoc perlop: "Binary,is the comma operator. In scalar context it evaluates its left argument, throws that value away, then evaluates its right argument and returns that value. This is just like C's comma operator."use strict; use warnings;. That would have told you that@valuedoesn't exist (it wasn't declared anywhere).