{ my @ACCESSORS = qw{ foo bar baz }; for my $slot (@ACCESSORS) { no strict 'refs'; *$slot = sub { my ($self) = @_; $self->{$slot}; }; } }