in reply to Trouble with flow control
what is really happening is you are assigning "n" to the variable answer. The value of the assignment is the thing being assigned, namely "n", which evaluates to true, so the if condition is satisfied.if ( $answer = "n" )
This still wont catch the case where the user enters "N" (capitalized). There are many ways to deal with this, i prefer:if ( $answer eq "n" ) {
This will uppercase the value of $answer, so then you only need to check it against the capital "N".if ( uc($answer) eq "N" ) {
hope this helps.confirm()
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: A missleading sub
by eoin (Monk) on Jun 11, 2003 at 12:03 UTC |