In trying to create a hash mapping stringified numbers to some values, I came across what seems to me to be a bug in the dwimmery of the => operator.
Having given it some thought, it's pretty clear that the problem is that the 09 is lexed and converted before the statement is parsed (hard to get around that, eh?). However, it still results in code that doesn't DWIM.
# perl -e "%a = ( 09 => 'a' )" Illegal octal digit '9' at -e line 1, at end of line
To me, that should map the string "09" (as forced by the => operator) to the string "a", while in fact perl tries to map 09 to octal, and then force string context.
I suppose I'm curious about this on a number of levels. First, is this something that I'll just have to live with? Second, is there even a practical solution? It would be hard to do syntatic analysis before tokenizing, but I still feel like => isn't behaving as expected.
Update: Before someone tells me to use an array, I have every intention for 01 to be a different key than 1.
In reply to Use of the => operator by roju
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |