At the top of the module put: my $DEBUG = 1; $DEBUG && require Data::Dumper; # them place statements like these $DEBUG && warn Data::Dumper::Dumper(\%hash); $DEBUG && warn "Sub foo() got @_\n";