in reply to Syntax error near ){
Corrected and formatted code :
Update:Un-commented "first last" - see hbo's note below.#!\usr\bin\perl -w my $secret= int(1+ rand 100); while(1){ print"please enter a number:"; chomp(my $guess=<STDIN>); if($guess=~/quit|exit|^\s*$/i){ print"Sorry,the number was $secret.\n"; last; }elsif($guess>$secret){ print "Too large,try again.\n"; ##last; }elsif($guess==$secret){ print"that is it.\n"; last; }else{ print"Too small,try again.\n"; } }
Earth first! (We'll rob the other planets later)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Syntax error near ){
by hbo (Monk) on Nov 11, 2004 at 04:50 UTC |