#! /usr/bin/perl use 5.014; my @CONVERSIONS = qw(000 001 010 011 100 101 110 111); sub conv2bin{ my $octal = sprintf ("%o", $_[0]); my @threeBitSeqs = map {$CONVERSIONS [$_]} (split //, $octal); return (join "", @threeBitSeqs); } my $result = 0b01011/0b11; say "decimal: $result"; my $bin= conv2bin($result); say "binary: $bin"; =head D:\>perl bin_div.pl decimal: 3.66666666666667 binary: 011 # 3 decimal (or 3.66667 truncated) expressed as binary. # Now, try this dividing -- oh, say, 6dec by 2dec... =cut