[comp.lang.perl] Unsigned ints in Perl

dan@kfw.COM (Dan Mick) (09/24/90)

I asked this of Randal in email, 'cause I was embarrassed to admit I couldn't
come up with anything on my own, and most of the current best solution is
his idea.  Anyway:

How can I work with 32-bit integral quantities as unsigned numbers?  If 
I use literals of the form 0xF0000000, for instance, or read input and
convert with hex(), the numbers end up negative, and I can't seem to force
them to positive except with 

$number = $number + 2**32 if ($number < 0)

which seems unwieldy and time-consuming, though maybe it's not so much the
latter.  Sure seems like there'd be a better way, though; there usually
is, in Perl.

Any ideas?  Anyone?