while (!$stop) { $a = ; chomp($a); $a =~ tr/0-9.//cd; if (length($a) < 1) { print "Please enter a number\n"; $stop = 1; } }