use warnings; use strict; my $base = 128; # OR to get 131 (10000011) $base = $base | 3; # combine NOT and AND and unset the last bit $base = $base &= ~(1 << 1);