Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Get values from array

by davido (Archbishop)
on Apr 21, 2014 at 20:21 UTC ( #1083080=note: print w/replies, xml ) Need Help??


in reply to Get values from array

Look at it this way:

$VAR1 = { '12349' => [ { 'name' => 'RIC', 'reference' => '00y77676', } ], 'X334' => [ { 'name' => 'MES', 'reference' => '0089kkjh9', } ], }; my $href = $VAR1->{12349}[0]; print $href, "\n";

What would you want print to do, if handed a hashref? What it does, is it stringifies the reference, and that's what you are seeing.

print "$_ => $VAR1->{12349}[0]{$_}\n" for keys %{$VAR1->{12349}[0]};

...will probably get you a little closer to what you want. Your structure is three levels deep. You're not penetrating it deeply enough.


Dave

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1083080]
help
Chatterbox?
[erix]: who can explain to me why Primary Key Fragmentation (whatever it may be) might be a problem?
[jedikaiti]: Pretty!
[erix]: ( TBH, I think it's a load of bull -- but maybe I'm mistaken )
[erix]: Hey that's Hungary - wave down ambrus and tell him to reboot his systems!
[choroba]: it might be a problem if you expect to reach the maximal possible value soon without squashing the ids
[erix]: that's really impossible with bigint
[erix]: and the site is still only 'hopefully' active :)

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2017-06-23 15:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (550 votes). Check out past polls.