> > On Dec 24, 2003, at 11:24 AM, [EMAIL PROTECTED] wrote: > [..] > > However, I have not seen this documented; could someone please (1) > > confirm or refute this (2) clarify if necessary and (3) point me to > > the relevant documentation. (The perlfunc page for ref() just lists > > possible return values, and not their meanings.) > > what you will want to read is > > perldoc perlref > > eg: > $scalarref = \$foo; > $arrayref = [EMAIL PROTECTED]; > $hashref = \%ENV; > $coderef = \&handler; > $globref = \*foo; > > the basic refs... > > so I think your question is: > > given > my @array = qw/bob ted carol alice/; > my $arrayref = [EMAIL PROTECTED]; > my $refref = \$arrayref; > > then > ref(@array) will return empty as @array is not a reference > ref($arrayref); will return "ARRAY" as it is an array ref > ref($refref); will return "REF" because it is a reference to something > that we did not recurse on. > > while of course ref($$refref); will get us back to the thing > that $refref references... and of course one can get back > to the array in itself with > > @$$refref >
Out of curiousity, why/when *in Perl* would you take a reference to something that holds a reference? And, "how deep does the well go?" (how far will Perl take the above indirection?)... I suppose I could just test, but I am rather lazy... http://danconia.org -- Boycott the Sugar Bowl! You couldn't pay me to watch that game. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>