in reply to Need help with complex tied data structure

Your code sample looks incomplete. You assign a ref to your tied hash to $data[$id] and then never do anything with it. Can you show a more complete example?

Replies are listed 'Best First'.
Re: Re: Need help with complex tied data structure
by genecutl (Beadle) on Nov 20, 2003 at 23:03 UTC
    $data[$gid] is a hash ref, so $data[$gid]->{$sample_id} is an element in that hash. To make it more explicit:
    foreach $sample_id (@{$groups[$gid]}) { $data[$gid]->{$sample_id} = []; # assign anon array ref to ti +ed hash foreach $element_num ( 0 .. $element_count ) { $element = []; # ... do a bunch of stuff here ... $data[$gid]->{$sample_id}->[$element_num] = $element; } }
    Does that make more sense?
      Is that a typo in your original code then? You never put the tied hash into $data[$gid], you put it in $data[$id] instead.