Sometimes, mistakes stare you in the face and you still miss them. This brief meditation is on the topic of special literals, one of which recently caused a frustrating bug for me. Realizing what had happened was a bracing reminder about when to use the cruciform operator.
For beginning to intermediate monks, ponder the following code snippet:
# In the file 'literal.pl' package Illumination; use strict; use warnings; use Data::Dumper; my %hash; $hash{__PACKAGE__}{__FILE__}{__LINE__} = "Mu Mu"; print Dumper \%hash;
What will it produce? Check your answer.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Special literals taken literally
by bobf (Monsignor) on Apr 14, 2006 at 03:58 UTC | |
Re: Special literals taken literally
by TimToady (Parson) on Apr 14, 2006 at 22:51 UTC | |
Re: Special literals taken literally
by larryl (Monk) on Apr 14, 2006 at 16:42 UTC | |
Re: Special literals taken literally
by diotalevi (Canon) on Apr 14, 2006 at 05:38 UTC | |
by xdg (Monsignor) on Apr 14, 2006 at 12:56 UTC |
Back to
Meditations