http://www.perlmonks.org?node_id=1116405


in reply to Re^2: How to interpolate CONSTANTS in Here docs?
in thread How to interpolate CONSTANTS in Here docs?

[...] builds a reference to an anonymous array, which is in turn de-referenced by @{...}. It's roundabout, but necessary in this case because the constants built by constant are actually functions, like sub OUT_DIR () { 'out' }, and a function call like OUT_DIR() (or OUT_DIR) isn't interpolated in strings, while scalars ($foo) and arrays (@bar) are, including dereferenced arrayrefs (@{$arrayref} - see e.g. Using References).