my $version= shift; if( "0" eq ( $version ^ $version ) ) { # $version already has a numeric value } else { # $version is _only_ a string }