in reply to Hashkey stringification ... sometimes.

Don't rely on "automatic quoting" too much... It's only garanteed to work for barewords. _$_ most definitely is not a bareword (= the kind of word one normally uses for variable and sub names). The same goes for the left hand side of =>, I'm sure _$_ will do the same magic trick there as it did in your code...
my %hash = ( _$_ => 'foo' );
this shows the following error when ran like this:
Can't call method "_" on an undefined value 

The fact that it actually compiles, without any complaint, may be a bit unfortunate... But it's nothing out of the ordinary.

Replies are listed 'Best First'.
Re: Re: Hashkey stringification ... sometimes.
by dragonchild (Archbishop) on Mar 29, 2004 at 12:53 UTC
    I just found an uglier case.
    rob@dev01 $ perl -MO=Deparse -e '$x{_$}' Missing right curly or square bracket at -e line 1, at end of line syntax error at -e line 1, at EOF -e had compilation errors. rob@dev01 $ perl -MO=Deparse -e '$x{_$}}' $x{$}->_}; -e syntax OK

    Just interpose the _ and $ in $_. In almost 9 years, I've never run into that. I must have typed "{$_}" almost a million times and never mistyped it. *shudders* That's the kind of typo that brings grey hair to men in the teens!

    And, then you have $x{y$}, which is transliteration, $x{s$}, which tries to do substitution ... either it quotes or it doesn't!

    ------
    We are the carpenters and bricklayers of the Information Age.

    Then there are Damian modules.... *sigh* ... that's not about being less-lazy -- that's about being on some really good drugs -- you know, there is no spoon. - flyingmoose