Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: my $var; vs. use constant VAR = '';

by antihero (Novice)
on Apr 27, 2001 at 00:59 UTC ( #75906=note: print w/ replies, xml ) Need Help??


in reply to my $var = ''; vs. use constant VAR => '';

eeek... I just noticed that I borked the title... it was meant to read

my $var =""; vs. use constant VAR => '';


Comment on Re: my $var; vs. use constant VAR = '';
Download Code
Re: Re: my $var; vs. use constant VAR = '';
by Rhandom (Curate) on Apr 27, 2001 at 02:29 UTC
    Something that is just as fast (slightly faster) than use constant, that can be localized, and that is neat, is to create a reference or alias to a non modifiable variable. Try this:
    local *CONST = \23.34234334234;
    Try to modify it. You can't. Declare it at the top of your program and it is there for life. Put it in a sub and it stays around for the life of the sub. See 75935 buried way at the bottom of this node.

    my @a=qw(random brilliant braindead); print $a[rand(@a)];

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (15)
As of 2015-07-06 17:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls