Because that's how elsif works. If the first "if" evaluates true, its block is executed, and then the entire construct of remaining elsif and else statements is skipped. Execution resumes on the line following the closing brace of the last elsif or else.
The elsif() condition is only evaluated for its Boolean result if the first if() was false.
This is very much similar to how else if (...) works in C and C++. In fact, though there are many languages I don't know, I can't think of any that do it differently.
Dave
In reply to Re: Perl If and Elsif statement help
by davido
in thread Perl If and Elsif statement help
by rammohan
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |