Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

Re^5: Memory issue with large cancer gene data structure

by hdb (Monsignor)
on Aug 21, 2013 at 13:06 UTC ( #1050342=note: print w/replies, xml ) Need Help??

in reply to Re^4: Memory issue with large cancer gene data structure
in thread Memory issue with large cancer gene data structure

Apologies for the late reply, I have been away for a while.

To answer your question: keys iterates through the keys of a hash while values iterates through the associated values in the same order. So if you find you are writing code like:

foreach my $key ( keys %hash ) { my $val = $hash{$key}; # do something with $val ... }

and not use $key otherwise you can write directly

foreach my $val ( values %hash ) { # do something with $val ... }

If $val is a reference to a hash as in %site_length_catch, then %$val is a hash and the game can start again for the inner loop. The final line $count = keys %$count; takes the hash reference $count, counts its keys and overwrites the hash reference with the number of keys, in this case the number of patients.

Hope this is helpful even if you have worked it out yourself already...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1050342]
[LanX]: hmm could be a myth since the root of throne is Greek
[LanX]: erix : the one armed who spent his last years in Dorn castle was a prince of Oranie ;)
[erix]: why does that tell against the Kaiser-story?
[erix]: ah, of course, makes sense
[erix]: mafia are family based, of course
[LanX]: Doorn
[erix]: yes, I got it :) It's close to where I live (Utrecht)
[LanX]: Dutch royals usually spent their exiles on Berlin

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-12-15 16:30 GMT
Find Nodes?
    Voting Booth?
    What programming language do you hate the most?

    Results (439 votes). Check out past polls.