|Just another Perl shrine|
Re^2: If statement not workingby andye (Curate)
|on Aug 24, 2012 at 15:09 UTC||Need Help??|
Use of "elsif" or hash tables don't seem to go to the point.
Actually either of those approaches does solve the problem, which is (if I'm understanding the OP correctly) that:
The OP thinks that the 'else' clause will be executed if NONE of the 'if' statements match, whereas actually the 'else' clause will be executed whenever the FINAL 'if' statement fails to match.
i.e. OP's intention was
but OP has got the syntax wrong and actually coded
where even if one of a, b or c is true then default() is still executed (and overwrites the variable) so long as d is false.
IIU the OP correctly.