Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Constant redefined

by tlm (Prior)
on May 31, 2005 at 02:58 UTC ( [id://461910]=note: print w/replies, xml ) Need Help??


in reply to Constant redefined

It's only a warning. You can suppress it with no warnings

{ no warnings; use constant TEST => 2; }

Update: Dang. That no warnings bit was all wrong, as noted by K_M_McMahon++. The worst of it is that I had even run the test

% perl -Mstrict -wle 'use constant x => 1; { no warnings; use constant + x => 4; } print x' Constant subroutine main::x redefined at /opt/lib/perl5/5.8.3/constant +.pm line 108. 4
but only paid attention to the fact that the last print out was correct, and completely ignored the fact that I was still getting a warning. Sheesh.

the lowliest monk

Replies are listed 'Best First'.
Re^2: Constant redefined
by K_M_McMahon (Hermit) on May 31, 2005 at 03:17 UTC
    I still get the error even using your no warnings code or with a global no warnings

    I am curious about the need to redefine a constant. If you are going to be changing its' value, you should be using variables anyway....

    -Kevin
    my $a='62696c6c77667269656e6440676d61696c2e636f6d'; while ($a=~m/(^.{2})/s) {print unpack('A',pack('H*',"$1"));$a=~s/^.{2}//s;}

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2025-03-27 01:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    When you first encountered Perl, which feature amazed you the most?










    Results (69 votes). Check out past polls.

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.