Your skill will accomplish
what the force of many cannot
Re: Given When Syntaxby kcott (Archbishop)
|on Mar 16, 2014 at 00:19 UTC||Need Help??|
However, as you're using 5.18.1, you'll now get warnings about experimental features unless you also switch them off like this (as explained in "perl5180delta: New mechanism for experimental features"):
Furthermore, that's somewhat counter-intuitive because, if you used what you might think would be the correct way to to do this, i.e.
What you actually need is:
Without this, you'll get a warning message for every given and when in your code, i.e. for the code you posted:
At this point, you may have decided not to use experimental features. They're certainly not a good idea in production code. Here's some additional information on both Switch and switch: "Re: switch statement".
Finally, here's a version of your code which generates no errors or warnings (I used 5.18.1 — the same version as you're running). In addition, while I see you've been provided with many alternatives to given/when, here's two more. [Note: this is just example code that includes no argument checking.]