I think I might be on to an explanation for the following line of code:

        push( @{ $children{$f} }, $c );

If someone would be so kind as to verify this for me, I'd appreciate it.

1) push $c onto the array specified by @{$children{$f}}.
2) $children{$f} must return a scalar array reference because the
surrounding @{..} expects a scalar array reference.
3) $children{$f} causes the %children hash to be created via
autovivification. 
4) Once %children is created, $children{$f} is set equal to an array
reference which is what it must return.
5) That array reference causes an anonymous array to be created via
autovivification, and the array reference points to that array. 
6) Therefore, for example,  $children{Adam} is linked to an anonymous
array via the reference stored as the value for that key.
7) The push then pushes $c on to that anonymous array.

-- 
Bill Gradwohl



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to