You could also use a closure:my $action = { dosomething => 'something' }; my $method = $action->{dosomething}; $obj->$method(@args);
my $action = { dosomething => sub { shift->something(@_) } }; my $whattodo = $action{dosomething}; $whattodo->($obj, @args);
In reply to Re: How do I create a reference to an object method?
by pc88mxer
in thread How do I create a reference to an object method?
by skrapasor
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |