I'm not sure where you got that
switch syntax, but it's wrong. Check out
perlsyn for the correct syntax (using
given/
when), although note that it's experimental, and you need to add a line to suppress the warnings as noted in the docs. You can rewrite it with a normal if/elsif/else chain.