Same for the other call.
You are basically redefining the sub again.
Please use strict and warnings to catch such problems earlier.
(Untested b/c I'm on mobile)
Cheers Rolf
(addicted to the Perl Programming Language and ☆☆☆☆ :)
Je suis Charlie!
The next issue will be that the 2 case can never be reached because you'll always die before in the first else .
Consider using elsif
if ($choice==1) { ... } elsif ($choice==2) { ... } else { die "wrong choice $choice" }
See perlsyn#Compound-Statements
In reply to Re: Using If/Else
by LanX
in thread Using If/Else
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |