Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re^3: json data: dereferencing arrays

by hdb (Prior)
on May 14, 2013 at 13:25 UTC ( #1033455=note: print w/ replies, xml ) Need Help??

in reply to Re^2: json data: dereferencing arrays
in thread json data: dereferencing arrays

No reason to get excited. Here is how I would usually do it by iterating directly over the structure.

my $position = 1200; for my $s (@$data) { next unless $s->{PROT_NAME} eq 'ALK'; foreach my $p ( @{ $s->{PDBS} } ) { foreach my $b ( @{ $p->{BLOCKS} } ) { if ($position >= $b->{PSTART} && $position <= $b->{PEND} ) +{ print ($p->{PDB_ID},"\n"); } } } }

Comment on Re^3: json data: dereferencing arrays
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (9)
As of 2015-11-25 20:27 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (690 votes), past polls