in reply to The last 5 bits in perl

Unsurprisingly...

my $last_5_bits = -9133545115225966845 & 31; # 3

although I'd prefer hex (but that's just me)

my $last_5_bits = -9133545115225966845 & 0x1f; # still 3