in reply to Re^3: Using a scalar as a constant?
in thread Using a scalar as a constant?
An eval is possible, but some people rather avoid eval. You can avoid eval by making use of a symbolic reference:
my $style = 'wxTE_MULTILINE'; { no strict 'refs'; say &$style; # or: say $style->() }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^5: Using a scalar as a constant?
by suaveant (Parson) on Oct 15, 2008 at 14:22 UTC | |
by JavaFan (Canon) on Oct 15, 2008 at 15:24 UTC | |
by chromatic (Archbishop) on Oct 15, 2008 at 17:27 UTC | |
by suaveant (Parson) on Oct 15, 2008 at 16:09 UTC |
In Section
Seekers of Perl Wisdom