On Sat, Jul 30, 2005 at 02:14:52PM +0200, Ingo Blechschmidt wrote:
: Hi,
:
: http://use.perl.org/~autrijus/journal/25337:
: deref is now 0-level; $x = 3; $y = \$x; $y++. # now an exception
:
: my $arrayref = [1,2,3];
:
: say $arrayref.ref;# Ref or Array?
Array.
: say $arrayref.isa(Ref); # true or false?
False, though tied($arrayref).isa(Ref) is probably true.
: say $arrayref.isa(Array); # false or true?
True.
: say +$arrayref; # 3 or error?
: say $arrayref + 1;# 4 or error?
Both work.
To the first approximation, refs to scalar non-object values must be
explicitly derefed. But refs to non-scalar containers are considered
objects so they will happily autoderef one level. It's possible we
may find a way to relax the former constraint, but if so, it would
go back to one-level deref, not all levels.
Larry