I ran the code you post and throw an error:
No data given to hexdump. at C:/Perl/site/lib/Data/Hexdumper.pm line 2
I've never used Compress::Raw::Zlib. but I think compress lib doesn't know what string or number is, it just treat all as binary data. So do you try to put number in to a file, binmode it and test it again?
$num_data = 7;
open(my $fh, '<', \$num_data);
I am trying to improve my English skills, if you see a mistake please feel free to reply or /msg me a correction