OK, one last modification, print actually takes a list as argument, so you want to write your debug as:
sub debug { print STDERR @_ if($debug); }so you can call it just like print:
debug "foo: ", @foo, "\n";And actually I usually define DEBUG as a constant:
use constant DEBUG => 1; # at the top of the code sub debug { print STDERR @_ if DEBUG; }
In reply to Re: A simple but good debug routine..
by mirod
in thread A simple but good debug routine..
by spm
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |