DEV Community

Discussion on: String Interpolation of Constants in Perl 5

Collapse
 
choroba profile image
E. Choroba

The important feature of constants is that they are inlined during the compile time, unlike Readonly. Interestingly,

"${ \CONSTANT }"

still inlines the value, but not the reference and dereference:

$ perl -Mconstant=ABC,42 -MO=Deparse -e 'print ABC, "${\ABC}"'
print '42', "${\'42';}";