sub option { my ($self,$arg,$value) = @_; return $self->{options}->{$arg} unless $value; $self->{options}->{$arg} = $value; } #### my %hash; @hash{('a'..'d')} = (1..4); #### sub foo { my ($self) = @_; } #### sub new { my ($class) = @_; my $self = { foo => 'bar', bar => 'maz', options => { anoption => 1, anotheroption => 'foo', option3 => 'barbar', }, }; return bless $self, $class; }