$DEBUG_LEVEL = 1; $DEBUG = $DEBUG_LEVEL ? sub {croak "$! $@";} : sub { 0; }; sub foo { do_something; if ($argh) {return &$DEBUG} return 1; } [download]
In reply to debug closure by dash2