|The stupid question is the question not asked
Given When Syntaxby Deep_Plaid (Acolyte)
|on Mar 15, 2014 at 15:34 UTC
Deep_Plaid has asked for the wisdom of the Perl Monks concerning the following question:
I have run across a situation where I need a Switch statement. After reading up on this online, it is my understanding that there really is no native Switch statement for PERL, and for later versions you should use the given/when construct (I'm using PERL v5.18.1 for Windows).
The problem is I can't seem to get the syntax right, even when using a dumbed down example I got from the web. Here's the code I'm trying to run:
That gives me the following errors:
If I can't get this to work, I'll be stuck using an if/elsif construct, illustrated below (this example works fine):
Any advice you can give would be deeply appreciated. Thanks.