$str =~ tr/0-9.+-//cd ; # Not perfect, but probably good enough. if ( $str == 0 } { ... }