Perl implementation of Huffman compression algorithm