in reply to Typeglobs and constant variables
Technically in perl-speak, that is the typeglob way to create a read-only variable, not a constant
This is a constant sub var() { 42 } print var;
This is a read-only
$ perl -Mstrict -le " our $var; *var= \3.14159; print $var; $var++ " 3.14159 Modification of a read-only value attempted at -e line 1.
This is fast read-only
$ perl -le " use Attribute::Constant; my $pi : Constant( 3.14159265358 +9793 ); print $pi; $pi++" 3.14159265358979 Modification of a read-only value attempted at -e line 1.
OTOH
$ perl -Mbignum=PI -le " print PI() " 3.141592653589793238462643383279502884197
|
|---|