Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: help to get hash elements

by philiprbrenan (Monk)
on Aug 26, 2012 at 23:16 UTC ( #989889=note: print w/ replies, xml ) Need Help??


in reply to help to get hash elements

use feature ":5.14"; use warnings FATAL => qw(all); use strict; use Data::Dump qw(dump); my $h = { 'response' => { 'blogs' => [ { 'url' => 'equipo.tumblr.com', 'name' => 'equipo', 'updated' => 1346015230 }, { 'url' => 'linux.tumblr.com', 'name' => 'linuxmint', 'updated' => 1345967468 } ], }, }; say $_->{url} for @{$h->{response}->{blogs}};

Produces

equipo.tumblr.com linux.tumblr.com

The ->{} ->[] operators can be used to position yourself within the structure and for @{} and for keys %{} can be used to iterate through parts of it.


Comment on Re: help to get hash elements
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://989889]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (9)
As of 2014-09-19 19:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (145 votes), past polls