print"Enter the starting amount: "; while( $startAmount !~ /^\d+/ ) { $startAmount = ; chomp( $startAmount ); if ( $startAmount !~ /^\d+$/ ) { print"Numbers only! Try again: "; } else { last; } } #### print"Enter the starting amount: "; { chomp( $startAmount = ); unless ( $startAmount =~ /^\d+$/ ) { print"Numbers only! Try again: "; redo; } # this line is reached if $startAmount is a number print "ok, \$startAmount is $startAmount\n"; }