Dear monks,
I'd like to call some named method on some Perl object via its normal direct method call syntax. Like this:
my $doomsday_weapon = Weapon::Doomsday->new; my $method = 'destroy_the_world_with'; my @args = qw(WMD, PHP, NSA); eval("\$doomsday_weapon->$method(" . join(', ', @args) .")");
Is there a way to do this somewhat more elegantly and without the unsafe eval()?
In reply to Calling a method by name without eval() by atemerev
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |