I personally would recommend using a constant if there's a possibility of constant folding:
#!/usr/local/bin/perl use O qw/ Deparse /; use constant CONDITION => 0; if( CONDITION ) { print "condition true\n"; } else { print "condition false\n"; } __END__ ## and here's the output. notice that there are ## no if's me@myhost> ./test.pl ./test.pl syntax OK sub CONDITION () { package constant; $scalar; } print "condition false\n";;
Otherwise I guess I could care less, but I use it more for a mental note than anything else -- it makes me aware that this value should be a constant
In reply to (lestrrat) Re(2): Accessing Constant Hashes
by lestrrat
in thread Accessing Constant Hashes
by enoch
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |