#!/usr/bin/perl use warnings; use strict; use constant DEBUG => not undef; use Data::Dumper; BEGIN { my ($a, $b, $c) = (1, 2, 3); my $deb; if (DEBUG) { $deb = sub { print Data::Dumper->Dump([$a, $b, $c], [qw/a b c/]); }; } else { $deb = sub { warn "Debugging not enabled!\n"; } } sub debug { &$deb } }