my $price = "123.45"; if ($price =~ m/^\d*\.\d{2}$/) { .. }