in reply to Special literals taken literally
Interesting. Apparently, I would have made the same mistake you did. :-)
The special literals __FILE__, __LINE__, and __PACKAGE__ represent the current filename, line number, and package name at that point in your program. They may be used only as separate tokens; they will not be interpolated into strings. If there is no current package (due to an empty package; directive), __PACKAGE__ is the undefined value.The original code gives:
But the "cruciform operator" can be used to interpolate tokens:$VAR1 = { '__PACKAGE__' => { '__FILE__' => { '__LINE__' => 'Mu Mu' } } };
$hash{+__PACKAGE__}{__FILE__}{__LINE__} = "Mu Mu";
$VAR1 = { 'Illumination' => { '__FILE__' => { '__LINE__' => 'Mu Mu' } } };
Double-cruciform (++) for the reminder.
|
|---|