print DEBUGOUT "\$var=$var\n" if DEBUGGING
Shows up all over my scripts. If I declare DEBUGGING as a constant the branches get compiled out, and I can choose to log the debug data for later or direct it to STDERR or STDOUT. I havn't done it yet, but I've been thinking about using btrott
's Filehandle Filter
to do even more with the DEBUGOUT filehandle. Oh, and data::dumper.pm is very useful too. Its rare that this technique doesn't provide me enough info and I have to resort to the debugger. But its nice to know that the debugger is there when I need it.