print ("Enter the number to check if it is actually a number:"); $input = <STDIN>; while ($input ne "") { chop ($input); if ($input =~ /^\d+$/ | $input =~ /^\d+.\d+$/ | $input =~ /^-\d+$/ | $ +input =~ /^-\d+.\d+$/) { print ("Yes, it is a number\n"); } else { print ("No, it is not a number\n"); } print ("Give another input:"); $input = <STDIN>; }
In reply to Reg Ex exercise by keesturam
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |