I have a co-worker who is a long-time C coder. He showed me a trick that I should have thought of a long time ago, but never occurred to me.
I use it often now and it simplifies things greatly.
At the head of a script, I add the line:
my $DEBUG = 1;
and after a variable should gain a new value, I add:
print $variable if $DEBUG;
This helps me make sure my variables are given the values that I want. When I want the text to run without the extra mess, I change $DEBUG to 0.
Anyone else have any neat practices that keep them honest, besides using 'strict' or '-w'?
JJ
Back to
Meditations