On Mar 15, Peter Rabbitson said:
<sigh>... I'll get it some day. As far as dereferencing with ->, which I asked earlier but I never got an answer to. For example are
$sources{${$batch_ref}{by_method}}{card_def}
and
$sources->($batch_ref->by_method)->card_def
No, not at all.
$sources{${$batch_ref}{by_method}}{card_def}
is the same as
$sources{$batch_ref->{by_method}}{card_def}
Here is what it comes down to. When you have a REFERENCE on the left side and a subscript on the right side, you can use a -> in between them:
my $a_ref = [10, 20, 30, 40]; print $a_ref->[2];
That is the same as $$a_ref[2]. $$a_ref[2] is the same as ${$a_ref}[2]. The idea there is that the name of the array goes inside the $...[2], and here, the "name" of our array is $a_ref. If it were something much more complex, we would wrap it in braces {...}. You might end up having something like ${$foo{bar}[2]}[5]. Using arrow notation, that would be written as $foo{bar}[2]->[5].
Finally, when you have two subscripts with an arrow between them, the arrow can be removed with no effect -- it's implied. $foo{bar}[2][5] is the same as $foo{bar}[2]->[5] which is the same as $foo{bar}->[2]->[5] which is the same as the ugly ${ ${ $foo{bar} }[2] }[5].
Read 'perlreftut' for more details.
-- Jeff "japhy" Pinyan % How can we ever be the sold short or RPI Acacia Brother #734 % the cheated, we who for every service http://japhy.perlmonk.org/ % have long ago been overpaid? http://www.perlmonks.org/ % -- Meister Eckhart
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>