in reply to Use of the => operator
You need to quote them explicitly so they are never tested as numbers. The fat comma stringification comes after numeric interpretation and before keyword recognition. I believe the details should be in toke.c in the root of the perl source distrubution.
(Added) Another few examples,
That shows numeric interpretation, then fat comma stringification, then keywords and subs. If keywords had been interpreted, the "length" key would have been "3" instead. If constant subs had been interpolated before, "bar" key would have been "quux".$ perl -Mstrict -we'BEGIN {$_="foo";} sub bar () {"quux"} my %foo = ( +1e0 => "foo", bar => "quux", length => "baz");print "@{[keys %foo]}", + $/' length bar 1 $
After Compline,
Zaxo
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Use of the => operator
by traveler (Parson) on Aug 09, 2004 at 21:39 UTC | |
by Zaxo (Archbishop) on Aug 09, 2004 at 21:51 UTC | |
by traveler (Parson) on Aug 09, 2004 at 22:02 UTC | |
by ysth (Canon) on Aug 09, 2004 at 22:38 UTC |