in reply to Re^4: ref eq "REF"
in thread ref == "REF"
perl -l *r = ["goose"]; *r = \"moose"; print ref \*r; print ${*r}; print @{*r}; __END__ GLOB moose goose
So you see, GLOB is a useful value in this case. In anycase - if ref() returns a true value, THAT means there is something to dereference here.
Just to make it clear: ref($r) returns "REF" if $r is a reference to a reference.
On the other hand, I agree that the REF return value just adds unnesessary complexity and returning SCALAR for a ref-to-a-ref would have been more consistent and simpler (just like an arrayref returns ARRAY, and doesn't care about the elements of the array).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: ref eq "REF"
by gaal (Parson) on Oct 19, 2004 at 10:11 UTC |