Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re^2: json data: dereferencing arrays

by hulketa (Initiate)
on May 14, 2013 at 12:46 UTC ( #1033451=note: print w/replies, xml ) Need Help??

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

uuoouu thank you so much!!!! I can see my errors now! you save my life!!! THANKS THANKS!!

Replies are listed 'Best First'.
Re^3: json data: dereferencing arrays
by hdb (Prior) on May 14, 2013 at 13:25 UTC

    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"); } } } }

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2016-09-30 09:36 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (563 votes). Check out past polls.