in reply to Re^3: How to access an object method when method name is stored in scalar variable
in thread How to access an object method when method name is stored in scalar variable

And this approach is fully orthogonal for passing parameters:

>perl -wMstrict -le " { package Foo; sub new { return bless { foo => 'woo' } => shift; } sub hoo_foo { my $self = shift; print qq{hi from hoo_foo: $self->{$_[0]}}; } } ;; my $oo = Foo->new; my $poo = 'foo'; my $method = qq{hoo_$poo}; $oo->$method($poo); $oo->${ \qq{hoo_$poo} }($poo); " hi from hoo_foo: woo hi from hoo_foo: woo
  • Comment on Re^4: How to access an object method when method name is stored in scalar variable
  • Download Code