#!/usr/local/bin/perl use Benchmark; use constant DEBUG_C => (1); sub DEBUG_S() { 1 } $DEBUG_V = 1; timethese( 4000000, { 'constant' => sub { my $x = 1 if DEBUG_C; my $y=2; }, 'subroutine' => sub { my $x = 1 if DEBUG_S; my $y=2; }, 'variable' => sub { my $x = 1 if $DEBUG_V; my $y=2; }, } );