... my $offset; BEGIN { $offset= 0; # Or BaseClass->_GetMaxOffset(); for my $attrib ( qw/ foo bar baz / ) { eval "sub _$attrib() { $offset }; 1" or die $@; $offset++; } } sub _GetMaxOffset { $offset } # Example method sub Foo { my $me= shift @_; my $old= $me->[_foo]; if( @_ ) { my $new= shift @_; # validate here $me->[_foo]= $new; } return $old; }