sub AUTOLOAD { no strict "refs"; my ($self, $value) = @_; # alias these to make it easier later if ($AUTOLOAD =~ /::get_(\w+)/) { *{$AUTOLOAD} = sub { return $_[0]->{$1} }; return $self->{$1}; } elsif ($AUTOLOAD =~ /::set_(\w+)/){ *{$AUTOLOAD} = sub { $_[0]->{$1} = $_[1] }; $self->[$1] = $value; return; } # handle other methods here or throw a warning }