in reply to How do I create a reference to an object method?

You could use a string:
my $action = { dosomething => 'something' }; my $method = $action->{dosomething}; $obj->$method(@args);
You could also use a closure:
my $action = { dosomething => sub { shift->something(@_) } }; my $whattodo = $action{dosomething}; $whattodo->($obj, @args);

Replies are listed 'Best First'.
Re^2: How do I create a reference to an object method?
by Anonymous Monk on Jun 25, 2008 at 19:32 UTC
    I was thinking about that, but I forgot about the arrow for use with hashes! It works, thank you.