in reply to Calling a method by name without eval()

Like this, you mean?
package Foo; sub new { bless {}, shift }; sub method { shift; return shift() + shift() } package main; my $foo = Foo->new; my $method = "method"; my @args = ( 2, 3 ); print $foo->$method( @args );

Or am I missing something?

Replies are listed 'Best First'.
Re^2: Calling a method by name without eval()
by atemerev (Beadle) on Mar 23, 2008 at 17:36 UTC
    Yes, right! Thank you.