in reply to Using Pre-processor directive in Perl
Yes, it is possible. But no, you should not use it.
There are two common ways of making code not run. One is to comment out code blocks with POD sections, but that cannot be done dynamically, and the other is to declare a subroutine as the toggle:
sub DEBUG() { 0 }; ... if (DEBUG) { print "We are here <--"; };
There is (almost) no overhead with this method because Perl optimizes constant subroutines away.
|
|---|