See, it shows print 'Constant is ', 1, "\n"; not print 'Constant is ', VALUE, "\n";$ perl junk Constant subroutine A::VALUE redefined at junk line 12. Constant is 1 $ perl -MO=Deparse junk package A; sub BEGIN { require strict; do { 'strict'->import }; } use constant ('VALUE', 1); sub func { use strict 'refs'; print 'Constant is ', 1, "\n"; } package main; sub BEGIN { use strict 'refs'; require strict; do { 'strict'->import }; } *{'A::VALUE';} = sub () { 2 } ; 'A'->func; junk syntax OK
In reply to Re^2: Overwriting a Constant
by Anonymous Monk
in thread Overwriting a Constant
by saintmike
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |