in reply to Re^2: Determining whether a value is zero.
in thread Determining whether a value is zero.

isn't dualvar's made by peeking at the internals ? I think it's unfair to try to detect something without the same techniques used to create that something, but hey it's your challenge.

On a unrelated note, is dualvar(undef,"string") zero ?

Replies are listed 'Best First'.
Re^4: Determining whether a value is zero.
by JavaFan (Canon) on Mar 11, 2011 at 15:36 UTC
    isn't dualvar's made by peeking at the internals ?
    Eventually, everything Perl is done by doing something with the internals. However, all dualvar exposes is that values can have both a numeric and a string value. One could change large parts of the internals without having to change the interface of dualvar. However, the solution presented queries internal bits of the SV structure.
    is dualvar(undef,"string") zero ?
    Yes. There's no way to store "undef" in the IV slot of an SV. AFAIK, the undef has been (auto)cast to 0 before the SV will be created.