in reply to Re: Re: Hash of refs to refs
in thread Hash of refs to refs

You got it!

Welcome to the wonderful world of anonymous data structures, if you don't already know about it, Data::Dumper is a wonderful module (that comes with the standard distro) for debugging your stuctures to make sure that really have the composition you desire. Example:

use Data::Dumper; print Dumper \%samples;
Dumper will take a scalar, an array, a hash, references, and more - i find it best to give it references to hashes and arrays instead. Experiment and find out why!

Also of interest to you might be Using stringified refs for unique IDs?.

Last tip:

# these 2 lines my $sample; foreach $sample (@samples) { # are usually better written as foreach my $sample (@samples) {
The difference is that the $sample in the second snippet is local to the foreach block and goes out of scope when the foreach is finished. Since you aren't using $sample anywhere else it appears, i recommend you use this approach. But, if you do need $sample later in the code, use the first snippet.

jeffa

L-LL-L--L-LL-L--L-LL-L--
-R--R-RR-R--R-RR-R--R-RR
F--F--F--F--F--F--F--F--
(the triplet paradiddle)