in reply to Perl "Constants"

If you want to continue using constant, and you want to interpolate within a string, the only way I know of is using the array interpolations:

use constant SOME_CONSTANT => 'the value'; print "This is @{[SOME_CONSTANT]}\n";

Within a hash key, treat it as a sub:

$h{&SOME_CONSTANT} = 'hash value';

Replies are listed 'Best First'.
Re^2: Perl "Constants"
by thunders (Priest) on Jul 07, 2009 at 03:13 UTC

    For string interpolation you may also use scalar context

    print "This is ${\SOME_CONSTANT}\n";

    With a hash key you can also disambiguate a constant with parens

    $h{(SOME_CONSTANT)}