in reply to Bug in perl bitwise or??

For a more complete discussion on Perl Value Types see Advanced Perl Programming, but to prarphrase from page 329 of my copy
A scalar value (SV - arrays are AV, hashs are HV etc) will be made up internally of its current value, a count of the number of references to that scalar, and an internal bitmask that decribes the current 'type' or 'state' of the value. These types can be
So what you need, to get away from
0|value1|value2
cruft is to force the scalar from type PV to IV

and _my_ favorite way to do this is
$value += 0;
this also my favorite way to trim leading zeroes from digit 'strings' - better than some regex's I've seen

Replies are listed 'Best First'.
Re: Re: Bug in perl bitwise or??
by diotalevi (Canon) on May 22, 2003 at 12:51 UTC

    Just to be slightly pedantic - saying 0 | $value produces a numeric value but doesn't actually alter $value. Writing $value |= 0 alters $value so it is numeric.