> my $string = "anssds"; > > and > > $string = "5879873454"; use Scalar::Util qw( looks_like_number ); if( looks_like_number $scalar ) { # perl will do math on it. } else { # perl will not do math on it. }