If the strings are short enough, you could pack them into integer values, but that means that you're limited to 16 letters (for 32 bit integers) or 32 letters (for 64 bit integers). Getting there is an interesting challenge. We can map {'A', 'C', 'T', 'G'} to {0,1,2,3} by taking
ord(x)&0x6>>1.
You'll probably want to look at the perldoc for the
pack and
unpack functions for some more specific ideas on how to get there.