package MyBaseClass; use strict; use warnings; use vars '$AUTOLOAD'; # or: our '$AUTOLOAD'; sub new { my $this = shift; my $class = ref( $this ) || $this; return bless {}, $class; } sub AUTOLOAD { my $self = shift; if ( $AUTOLOAD =~ /::(.*)$/ ) { my $method = $1; if ( $method ne 'DESTROY') { return $self->{address}{$method} if exists $self->{address}{$method}; return undef; } } } 1;