Perl Monk, Perl Meditation | |
PerlMonks |
Re: Re: my $var; vs. use constant VAR = '';by Rhandom (Curate) |
on Apr 27, 2001 at 02:29 UTC ( [id://75950]=note: print w/replies, xml ) | Need Help?? |
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:
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)];
In Section
Seekers of Perl Wisdom
|
|