in reply to bareword hash keys
You confusion is between '-' being part of the bareword, and - as the unary negation operator. perl -MO=Deparse,-p -e "$foo{-bar}" outputs $foo{-'bar'};. The scalar negation operator is defined rather oddly in perl -- when you try to negate a string, it doesn't nummify and then negate (which would give 0), but rather prepends a dash.
There is still some bareword magic going on, to turn the b (in your example) into 'b' rather then a call to the (non-existant) b() function.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: bareword hash keys
by John M. Dlugosz (Monsignor) on Jun 23, 2003 at 04:54 UTC |