sub weird2number { my $text = shift; unless ($text =~ /^\d*\.\d+D[+\-]\d+$/) { warn qq{Argument "$text" is not weird}; } no warnings "numeric"; return $text + 0; }