use warnings; use strict; print "Please input a decimal no. to convert to binary : "; chomp (my $value = ); print map { ($value & (1 << (7 - $_)))? 1: 0 } ( 0 .. 7 ); print "\n";