On Tue, 7 Jul 2015 11:40:35 +0000
"Sharanbasappa Raghapur, ERS, HCLTech" <shar...@hcl.com> wrote:

> I am using constant mainly to enable printing of debugging messages
> (e.g. use constant DEBUGGING_L1 => 0;) Normally, the value is '0' and
> when I need to see debug messages, I make this 1 and run the script.
>
> Is there a way to allocate value to constants at run time so that I
> can avoid editing the script again and again? Also, is there a better
> way to handle debugging?

You don't get those conditional compilation speedup's
but you could pass an argument to the script to save
editing:


#!perl
my $DEBUG;
($DEBUG = shift) //= 0;  # no debug if no arg missing
...

if ($DEBUG) { ... }

-- 
Charles DeRykus

-- 
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to