in reply to Decoding .z and .gz files

If it really is a (lowercase) .z and not (uppercase) .Z, then Wikipedia's List_of_archive_formats says that's Huffman_coding ("officially" called "pack"), so maybe Algorithm::Huffman would help.