use 5.010; use strict; use warnings; use constant DEBUG => 1; no if DEBUG, warnings => 'uninitialized'; my $x = 23; my $y; say "With DEBUG = ", DEBUG; debug("x='$x' y='$y'") if DEBUG; if (DEBUG) { sub debug { say shift; } }