5.3. Raise the Flag

Our option so far is binary: either we print a tracing statement or we don't. But suppose we want to discriminate and print some tracing statements at some times, and others at other times. Perhaps we want to preserve our earliest tracing statements; even though we suspect they've become redundant now that the code around them is working, we want to keep them around. Fair enough. We can create classes of tracing statement and assign a number to each one:

Number Statement Class
1 The very first tracing statements we entered
2 The next tracing statements we entered, which we want to keep distinct
4 Another set of statements that are distinct from 1 and 2

And so on. The numbering scheme is not random: by using successive powers ...

Get Perl Debugged now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.