in reply to Typeglobs and constant variables
There's a built in pragma called constant which I'd probably reach for before trying to do something clever with typeglobs:
$ perl -Mstrict -Mwarnings -le ' use constant MYVAR => 3.14159; print MYVAR; use constant PI => 4 * atan2(1, 1); print PI; ' 3.14159 3.14159265358979
However, if you're stuck with the typeglob, I'd take a pragmatic approach and pick the one which involves the least typing (i.e. ${*myVar}).
$ perl -Mstrict -Mwarnings -le ' *myVar = \3.14159; print ${*myVar}; print ${*myVar{SCALAR}}; print $main::myVar; ' 3.14159 3.14159 3.14159
-- Ken
|
|---|