####################################################################### # DEBUG ==0 {no debugging}, ==1 {debugging}, >=2 {greater debugging} ######################################################################## # our $Debug = 0; our $DLOG; ## Production our $Debug = 4; our $DLOG; ## Testing if ( $Debug ) { my $logFile = "MyLog_$$"; ## Good for multi-user testing open($DLOG,">",$logFile) || die "Cannot open $logFile:$!"; print $DLOG "############################# ".scalar localtime()."\nStart. . . \n"; } else { open $DLOG, ">>", "/dev/null" ); } #### for my $key { sort keys %Hash ) { ... do something ... if ( $Debug >= 4 ) { print $DLOG "Hash:\t$key\t|$Hash{$key}|\n"; } }