$CODEREFS{1}{1} = { property => 'value', ... cref => sub { ... } }; $CODEREFS{1}{2} = { property => 'value', ... cref => sub { ... } }; ... #### package Blah; use strict; use warnings; require 5; use Carp; our %CODEREFS; $CODEREFS{1}{1} = { property => 'value', cref => sub { my $self = shift; } }; sub new { my $class = shift; my $self = { crefs => \%CODEREFS }; bless $self, $class; } sub access { my $self = shift; my ($a, $b) = (shift, shift); $self->{crefs}{$a}{$b}{cref}->($self, @_); } package main; use strict; my $blah = Blah->new(); $blah->access(1, 1);