in reply to A simple but good debug routine..

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; }

Replies are listed 'Best First'.
Re: Re: A simple but good debug routine..
by davorg (Chancellor) on Sep 07, 2001 at 16:04 UTC