# Assume you have use Compress::Zlib; use Carp; # Here is the function. It takes text, and returns 3 # possible answers. 1 if the text looks unencrypted. # 0 if it looks encrypted. And undef if it is not able # to tell reliably. sub text_is_normal { my $text = shift; length($text) < 50 ? undef : (length(compress($text)) < 0.8*length($text)); }