Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi I am learning Perl using Padre. I am trying to run a piece of code using the "if/else or die" statements. I am giving it 2 choices but it will not recognize either choice and kills it. Can y'all show me what I am doing wrong? Thanks.
print "Your time is almost out make a choice either 1 for Vampire or 2 + for Werewolf. \n"; chomp ($choice=<STDIN>) ; if ($choice== 1) {sub vamp ; } else {die } if ($choice== 2) {sub wolf ; } else {die } sub vamp {print "Congratulations $name on choosing to become a vampire +. I will turn you as requested and be your mentor until I deem you ready to go out o +n your own. \n"; } sub wolf {print "Congratulations $name on choosing to become a werewol +f. I will turn you as requested and introduce you to my pack where you will learn of +your new skills. \n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Using If/Else
by LanX (Saint) on Apr 19, 2017 at 20:25 UTC | |
|
Re: Using If/Else
by AnomalousMonk (Archbishop) on Apr 20, 2017 at 00:03 UTC | |
|
Re: Using If/Else
by Anonymous Monk on Apr 19, 2017 at 20:38 UTC |