Yeah, you can explain this behavior. But it is, frankly, stupid. \\$x is, indeed, a reference to a scalar and so ref should return "SCALAR". Having a special case for "reference to a scalar that happens to currently be holding a reference" is silly. It just leads to code having to check for both "SCALAR" and "REF", adding complexity. It makes about as much sense as having ref(\\\$x) return "REFREF" or ref(\\@x) return "ARRAYREF" or ref([]) return "EMPTYARRAY".
- tye
In reply to Re: Why do I (sometimes) get a REF ref and not a SCALAR ref? (silly)
by tye
in thread Why do I (sometimes) get a REF ref and not a SCALAR ref?
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |