package Test; use strict; sub new { my ($caller, @args) = @_; return bless {}, $caller || ref($caller); } sub test1 { print "Worked from 1\n"; } sub test2 { print "Worked from 2\n"; } package main; use Test; my $tes = new Test; my $rf = { test1 => 'test1', test2 => 'test2', }; no strict 'refs'; no strict 'subs'; $tes->$rf->{test1}();