Skip to content

Instantly share code, notes, and snippets.

Created Feb 27, 2013
What would you like to do?
This is why 'use constant' is bad.
#!/usr/bin/env perl
use warnings;
use strict;
use Data::Dumper;
use constant MY_CONSTANT => 13;
my %foo = (MY_CONSTANT => 'dingle');
print Dumper \%foo;
$VAR1 = {
'MY_CONSTANT' => 'dingle'
Copy link

clayne commented Aug 15, 2016

Use +MY_CONSTANT or &MY_CONSTANT in the hash key portion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment