I am trying to inter-convert some decimal and binary numbers. I am working with data produced in the following format:

```
Example decimal: 163,   Corresponding binary: 10100011

Binary table key:

```

![enter image description here](https://i.stack.imgur.com/LDIhF.png)

```
...and the corresponding description for the binary number in question:

```

![enter image description here](https://i.stack.imgur.com/nhbCe.png)

I want to be able to take a decimal number, convert it to binary, and then use this look-up table to print a list of attributes for a given decimal. I'm able to convert my decimal to binary using this code:

```
sub dec2bin {
    my $str = unpack("B32", pack("N", shift));
    $str =~ s/^0+(?=\d)//;   # otherwise you'll get leading zeros
    return $str;
}

```

But then don't see how to use the lookup table. The problem is, I have binary numbers specifically designed to be compatible for this table, such as 1000011, 10000011, 101110011, but I just don't see how to use these binaries to pull our their descriptions. They are even different lengths!

Can someone please help me understand what is going on here?

EDIT: here is another look-up table I found... perhaps this is more accurate/helpful? It looks identical to me, but is from the software's offiical [website](http://samtools.sourceforge.net/samtools.shtml#5). 

![enter image description here](https://i.stack.imgur.com/XG7nv.png)