##
sub Debug {
if ( $debug ) {
my $msg = shift;
print $msg, "\n";
}
}
####
Debug( "Entering calculation phase." );
Debug( "Pre-calculation value of \$x: $x" );
...
Debug( "Leaving calculation phase." );
Debug( "Post-calculation value of \$x: $x" );