in reply to Re: Re: Re: How to create a "CONSTANT"
in thread How to create a "CONSTANT"
Consider, for the heck of it, this:
Then someone comes along and changes the constant...use constant TWO => 2; $x = TWO; print "$x ${\TWO}\n";
Oops. So, if you are going to do that defensively you should be a little more explicit...use constant TWO => qw( one three ); $x = TWO; print "$x ${\TWO}\n";
Sure, anyone who goes around changing constants should expect fire and brimstone to rain down on him... but it still happens. :-)use constant TWO => qw( one three ); $x = TWO; print "$x ${\scalar TWO}\n";
-sauoq "My two cents aren't worth a dime.";
|
|---|