in reply to Re: To DEBUG, or to COMMENT. _That_ is the question
in thread To DEBUG, or to COMMENT. _That_ is the question

How about the -P flag, as documented in perlrun (with a huge list of caveats)?

Replies are listed 'Best First'.
Re^3: To DEBUG, or to COMMENT. _That_ is the question
by Athanasius (Archbishop) on Nov 09, 2013 at 03:19 UTC

    The -P command-line switch was deprecated in perl version 5.10.0 and removed as of version 5.12.0 (see perl5120delta). But the equivalent behaviour is provided by the module Filter::cpp:

    #! perl use strict; use warnings; use Filter::cpp; #define DEBUG #define XYZ 42 #ifdef DEBUG print "Debugging enabled\n"; #else print "Debugging disabled\n"; #endif print XYZ . "\n";

    Output:

    13:14 >perl 772_SoPW.pl Debugging enabled 42 13:14 >

    See perlfilter.

    Athanasius <°(((><contra mundum Iustus alius egestas vitae, eros Piratica,

      You're right, of course. For some reason I had a terminal window open with a Perl 5.10.1 environment and chose that one to run perldoc instead of anything more recent.