March 2001
Intermediate to advanced
288 pages
4h 56m
English
After typing in a tracing statement, taking it out after the code is “working,” then putting it back in when the code mysteriously stops working, you're motivated to find a way to leave it in there and selectively enable it.
The most primitive way is to comment it out, but since there are no independently compiled binary executables for Perl programs,[4] this isn't as bad a solution as it would be for, say, C—you'd have to rebuild the executable and have a way of knowing whether it was in sync with the source. Just make sure that if your print statement exceeds one line, you comment/uncomment all the lines.
[4] With a few qualification-ridden exceptions.
The next most basic option is to create a program-wide Boolean variable ...