biofeng918 has asked for the wisdom of the Perl Monks concerning the following question:
#!\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"; } } } }
when i run it,the systerm remind me that there are syntax at the line 3,near"){" and at the line 17,near"}",i don't know why,who can help me.
2004-11-11 Edited by Arunbear: Changed title from 'help', as per Monastery guidelines
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Syntax error near ){
by bgreenlee (Friar) on Nov 11, 2004 at 01:40 UTC | |
|
Re: Syntax error near ){
by erix (Prior) on Nov 11, 2004 at 01:44 UTC | |
|
Re: Syntax error near ){
by NetWallah (Canon) on Nov 11, 2004 at 01:49 UTC | |
by hbo (Monk) on Nov 11, 2004 at 04:50 UTC | |
|
Re: Syntax error near ){
by Popcorn Dave (Abbot) on Nov 11, 2004 at 05:15 UTC | |
|
Re: Syntax error near ){
by buttroast (Scribe) on Nov 11, 2004 at 05:53 UTC |