in reply to Re^5: Using a scalar as a constant?
in thread Using a scalar as a constant?
Having said that, and given the fact the subname comes from some XML document whose creation may not be under our control, I would neither use eval, nor a symref, and not can either. I'd make a dispatch table allowing only values I approve of.
my $style = ... retrieve from XML document ... my $value; given ($style) { when ("sub1") {$value = sub1} when ("sub2") {$value = sub2} ... default {die "Illegal style '$style'"} } Wx::TextCtrl->new( $self, -1, "", [5, 10], [-1, -1], $value);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: Using a scalar as a constant?
by chromatic (Archbishop) on Oct 15, 2008 at 17:27 UTC | |
|
Re^7: Using a scalar as a constant?
by suaveant (Parson) on Oct 15, 2008 at 16:09 UTC |