use strict; use warnings; use feature 'say'; my $method = []; { package Local::Class; sub new { my ( $class ) = ( shift ); bless {}, $class; } no strict 'refs'; *{"$method"} = sub { say for @$method }; }; my $object = 'Local::Class'->new(); @$method = ( "Hello", "world" ); $object->$method;