in reply to I don't understand.
in thread Detecting if a scalar has a number or string

Among other reasons:

sub is_a_num { $_[0] =~ m/^[0-9]*$/ } my $not_at_all = ''; print is_a_num( $not_at_all ) ? "Yeppers.\n" : "Nopers.\n";

Beware the Star of Regex!