my @array= map { qw(heads tails)[$_] } (split (//, unpack ("b*", $bits))); print "@array";