use Subs; my %menu = ( n => \&Subs->new; ); . . . $menu{n}->();