Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

(lestrrat) Do use 'constant': Re(4): Am I missing something here?

by lestrrat (Deacon)
on Nov 08, 2001 at 23:09 UTC ( #124135=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    *DEBUG = \1;
    use constant CONST_DEBUG => 1;
    $DEBUG && print "foo\n";
    CONST_DEBUG && print "bar\n";
    
  2. or download this
    ## Output of perl -MO=Deparse on my machine with perl 5.6.1:
    *DEBUG=\(1);
    ...
    }
    print "foo\n" if $DEBUG; # <- $DEBUG must be evaluated each time
    print "bar\n"; # <- there's no evaluation... just straight print()'ing
    

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://124135]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2023-01-31 23:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?