Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Quick question. Assume the following variable values:
my $meth = "prefix_foo"; my $x = "foo";
Perl allows me to do this:
Some::Class->$meth;
but not this:
Some::Class->"prefix_$x";
My workaround at the moment is:
Some::Class->${\("prefix_$x")};
Is there a more straightforward version? Besides the more obvious two-statement version, that is.
my $tmp = "prefix_$x"; Some::Class->"prefix_$tmp";
Back to
Seekers of Perl Wisdom