### At the top of the script my $debug = 1; # Set to '0' to disable debugging output sub debug { warn "DEBUG ($_[0]): <<<$_[1]>>>" if $debug; } [...] ### Some troublesome variable or value debug('$foobar', $foobar);