in reply to Re: Snippet explanation please
in thread Snippet explanation please
(though i guess DOUBLE_BYTE could be a constant, in which case the key is really the constant's value.)Actually, it's not:
By that logic, it should print 'b' instead. Remember, "constants" in Perl are really just subroutines, not C-style macros. The rule that a bareword as a hash key is always treated as a string applies whether or not there's a subroutine or constant with that name defined.use constant a => 'b'; my %foo; $foo{a} = "x"; print keys %foo; __END__ a
|
|---|