use strict; use warnings; print "Enter the number to check if it is actually a number: "; while () { chomp; if (/^(\d+|\d+.\d+|-\d+|-\d+.\d+)$/) { print "Yes, it is a number\n"; } else { print "No, it is not a number\n"; } print "Give another input: "; }