http://www.perlmonks.org?node_id=205855

KPeter0314 has asked for the wisdom of the Perl Monks concerning the following question:

As I am just a lowly monk, I come to the greater wisdom of the group.

I have a set of values that I would like to possibly store in a binary-style array. The data looks something like this:

Slot 0 1 2 3 4 5 6 7 Value A A B B C C B B
Is there a way to store the values binary-style? That way the values for A, B, and C would be 11000000, 00110011, and 00001100 respectfully.

I would also need a method to mask the info back out of the binary storage to get my results back. e.g. (in bad pseudo-code)

if ( mask 01000000 matches arrayA )
then A is slot 1

Or, am I trying too hard?

-Kurt