__PACKAGE__ gets treated as a string, as does any bareword (keyword or not) that you use to index a hash (think $foo{shift}). The easiest fix is adding a plus sign to make it an expression instead of a string.$ perl -MO=Deparse -e '$hash{__PACKAGE__} = 1' $hash{'__PACKAGE__'} = 1;
$ perl -MO=Deparse -e '$hash{+__PACKAGE__} = 1' $hash{'main'} = 1;
blokhead
In reply to Re: usage of __PACKAGE__
by blokhead
in thread usage of __PACKAGE__
by eXile
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |