my $DEBUG = 1; #Set to 1 (print debugging info) or 0 (no debugging) print "Script executing...\n" if $DEBUG; do_stuff(); sub do_stuff{ print "sub->do_stuff()\n" if $DEBUG; #do things here... }