in reply to Trying to understand the 'use constant' pragma
An alternative is to use the string as a method to the package where the constants are defined, e.g.:
package Foo; use constant LOG_DEBUG => 0; package main; my $log_level = 'LOG_DEBUG'; print Foo->$log_level, "\n";
|
|---|