in reply to Syntax error near ){

You were using last() gratuitously, and had too many "}". If you want to allow guesses for multiple numbers, add a loop around creating a new value for $secret, and re-engineer exit conditions.

Corrected and formatted code :

#!\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"; } }
Update:Un-commented "first last" - see hbo's note below.

    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
    The first last (did I just say that?) is still required to make the loop exit on surrender.

    The second one is correctly in error. (Gotta love them non-sequiters. 8)

    "Even if you are on the right track, you'll get run over if you just sit there." - Will Rogers