in reply to my vs. local subtlety

All of the above comments are valid. But if one: a) has used symbolic refs successfully in other situations; b) does not recognize that symbolic refs find only package variables; c) does not recognize that "my" variables are lexical; d) uses "my" variables frequently in subroutines to avoid the possibility of duplicate variable names; and e) does not recognize that the use of such constructs in a subroutine are "unsafe", "non-robust", "non-versatile", and difficult to maintain; then one can get very frustrated trying to figure out why something isn't working as expected. Some or all of those things applied to me when I wrote that code initially 2-3 years ago. To someone who may be new to Perl, or is not experienced in some of these things, the distinction may boil down to a difference between using "my" and "local" without understanding what is under the covers.

Thanks for your comments. I was not familar with the "map" function mentioned above so I have something new to learn about.

I rewrote the subroutine in the original snippet long ago by passing a list of array refs rather than the letters so the original snippet is only of value to others if this discussion helps them to avoid the pitfalls mentioned.