Created
February 27, 2013 21:40
-
-
Save earino/5051998 to your computer and use it in GitHub Desktop.
This is why 'use constant' is bad.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
# | |
use warnings; | |
use strict; | |
use Data::Dumper; | |
use constant MY_CONSTANT => 13; | |
my %foo = (MY_CONSTANT => 'dingle'); | |
print Dumper \%foo; | |
#yields: | |
$VAR1 = { | |
'MY_CONSTANT' => 'dingle' | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Use
+MY_CONSTANT
or&MY_CONSTANT
in the hash key portion. http://perldoc.perl.org/constant.html#CAVEATS