For Programmers: Free Programming Magazines  


Home > Archive > PERL Beginners > July 2005 > Accessing Elements in data structure









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Accessing Elements in data structure
greg.scharlemann@gmail.com

2005-07-31, 5:15 pm

I made a call to a given web server to translate a US address its
lat/lon position and I was returned a variable $result. When I do

print Dumper $result;

The following prints:

$VAR1 = [
bless( {
'number' => '1600',
'street' => 'Pennsylvania',
'lat' => '38.898748',
'state' => 'DC',
'city' => 'Washington',
'zip' => '20502',
'suffix' => 'NW',
'long' => '-77.037684',
'type' => 'Ave',
'prefix' => ''
}, 'GeocoderResult' )
];

My question: How do I access the elements within $result?
i.e.
print $result->{number}; #doesn't print anything

Thanks for your help

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com