Seems more like a matter of taste to me, whether you prefer a hash of subs or the ternary operator to your original elsif cascade.
OTOH using warnings with your code, perl would comment on your using one-element hash slices instead of array element references.
Also the OP could use another pair of <code> tags, since the links to node 2 and 4 are interesting, but somewhat OT. ;-)
In reply to Re: Better way of matching
by pKai
in thread Better way of matching
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |