use strict; use warnings; # you can declare a nunber in many different formats. # see https://perldoc.perl.org/perlnumber.html # my $N1 = 0b11010111; my $N2 = 0b10110100; # or $N2 = 180; # or $N2 = 0xb4 # logical *bitwise=bit-by-bit* AND: (and not &&), btw OR is | my $N1_AND_N2 = $N1 & $N2; # you can print a number in many different formats # by default it prints in decimal print "Decimal notation: $N1 AND $N2 = $N1_AND_N2\n"; # but youn change the print format using printf (C-like): printf "Binary notation: %b AND %b = %b\n", $N1, $N2, $N1_AND_N2; printf "Hex notation: %x AND %x = %x\n", $N1, $N2, $N1_AND_N2;