if ($amount =~ /^\d+\.\d\d$/) { # it's ok } else { # it's bad }