use constant DEBUG => 0;
####
use strict;
use warnings;
use constant DEBUG => 0;
print "Hello World\n";
print "This is a debug Statement\n" if DEBUG;
print "Goodbye Cruel Word\n";
####
use constant ('DEBUG', 0);
use warnings;
use strict 'refs';
print "Hello World\n";
'???';
print "Goodbye Cruel Word\n";
####
use strict;
use warnings;
use Benchmark qw( cmpthese );
use constant DEBUG => 0;
my $b = 100;
cmpthese -10, {
constant => sub { my $a = 10 * $b; $a = 10 * $b if DEBUG; },
noconstant => sub { my $a = 10 * $b; },
};
####
Rate constant noconstant
constant 1498536/s -- -17%
noconstant 1796946/s 20% --