in reply to Perl script to calacuate percentage statistics, does not display 0% in output

Most of the code you posted is irrelevant to the question. Or even worse - it makes it almost impossible for us to find where in the code the problem happens (you haven't indicated it in a comment or otherwise).

After reading the code, it seems to me defined or length is what you need:

#!/usr/bin/perl use warnings; use strict; my @data = (100, 10, 0, undef, q()); no warnings qw( uninitialized numeric ); for my $token (@data) { printf "PLAIN |%d|\tDEFINED ", $token; printf defined $token ? "|%d|\t" : "\t", $token; print "LENGTH "; printf length $token ? "|%d|\n" : "\n", $token; }

Output:

PLAIN |100| DEFINED |100| LENGTH |100| PLAIN |10| DEFINED |10| LENGTH |10| PLAIN |0| DEFINED |0| LENGTH |0| PLAIN |0| DEFINED LENGTH PLAIN |0| DEFINED |0| LENGTH
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,