#!/usr/bin/perl -w use strict; my $num; while() { print 'Enter a number between 1 and 10 (inclusive): '; chomp( $num = <STDIN> ); if( $num gt "9" ) { print "Numbers only. That was a string!\n"; next; } if( $num < 1 || $num > 10 ) { print "Please enter a value greater than one or less than 10\n"; next; } print "Thank you. You entered $num\n"; last; }
In reply to Re: restart program on wrong user input.
by DigitalKitty
in thread restart program on wrong user input.
by BioGeek
For: | Use: | ||
& | & | ||
< | < | ||
> | > | ||
[ | [ | ||
] | ] |