Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re: help with hashes

by gaal (Parson)
on Mar 15, 2005 at 11:56 UTC ( #439597=note: print w/ replies, xml ) Need Help??

in reply to help with hashes

To subscript a hash, say $aminoacids{ $the_key }. (In your case, the keys are numeric so you may as well be using an array?)

This interpolates in a string, too, so you can say:

print "$aminoacids{$i} $aminoacids{$j} $aminoacids{$k}\n";

Though you can use the more idiomatic hash slice and select several things at once.

print join " ", @aminoacids{$i, $j, $k}; # note the '@'
Comment on Re: help with hashes
Select or Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://439597]
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: (10)
As of 2016-04-28 23:00 GMT
Find Nodes?
    Voting Booth?
    :nehw tseb si esrever ni gnitirW

    Results (437 votes). Check out past polls.