in reply to Why do I (sometimes) get a REF ref and not a SCALAR ref?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Why do I (sometimes) get a REF ref and not a SCALAR ref?
by Anonymous Monk on Jun 23, 2016 at 19:53 UTC | |
by tye (Sage) on Jun 23, 2016 at 20:01 UTC | |
by Anonymous Monk on Jun 23, 2016 at 20:03 UTC |