Do not use Switch.pm - it is a bad idea gone horribly wrong and will cause you hard to find bugs merely by its presence in your code.
As you didn't show the full code, I can't really make any better recommendation, but a set of if ... elsif ... isn't much worse to type than switch.
Update: Here are some local discussions of things to do instead of using switch: Switch.pm or possible alternatives, and here is discussion of some error as introduced by switch - I don't know if the code on quantums scratchpad is still there though.
In reply to Re: Switch and $1?
by Corion
in thread Switch and $1?
by pianogirl95
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |