in reply to binary numbers

my $num = shift; if ( $num < 0 ) { $num ^= (~0) ^ 255 };

Replies are listed 'Best First'.
Re: Re: binary numbers
by hawtin (Prior) on Jan 30, 2004 at 09:00 UTC

    Surely a simpler way would be

    # Trim number to 8 bits my $num = 0xff & shift;