in reply to using constants to trigger debug code

If the compiler can determine at compile time that an expression will never be evaluated, it will remove the code. For example:

use strict; use warnings; print "Hello world" if 0; exit 1 if 0; exit 0;

looks like this to the Perl compiler:

$ perl -MO=Deparse /tmp/compile.pl use warnings; use strict 'refs'; '???'; '???'; exit 0;

The two .. if 0; lines are turned into void strings which take basically no time to evaluate.