in reply to elsif statement not being evaluated
Hi jonagondos,
check this in your code:
I suppose you want to useif ( $choice = $an2 ) { ... } elsif ( $choice = $an1 ) { ... }
You are assigning to variable $choice, the value of the variable $ans2 using the assignment operator '=' .if ( $choice == $an2 ) { ... } elsif ( $choice == $an1 ) { ... }
So, whatsoever, value inputted was replaced by the value of variable $ans2.
In which case variable $choice value is ALWAYS evaluate to 2 the pre-defined value of variable $ans2, so your elsif(){...} statement is not being evaluated.
If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: elsif statement not being evaluated
by jonagondos (Novice) on Nov 18, 2012 at 06:29 UTC | |
by afoken (Chancellor) on Nov 18, 2012 at 08:35 UTC | |
by flexvault (Monsignor) on Nov 18, 2012 at 15:42 UTC | |
by Anonymous Monk on Nov 18, 2012 at 16:00 UTC |
In Section
Seekers of Perl Wisdom