#!/usr/bin/perl use strict; use warnings; use Data::Dumper; # erzeuge eine Hashreferenz (simuliert das Objekt) my $self = {}; # simuliere $handler->conf('XYZ','Wert'); my $value = conf($self,'XYZ','Wert'); print $value; sub conf { my ( $self, $option, @params ) = @_; print Dumper $self; if ( scalar @params ) { # if parameter submitted, set it $self->{CONFIG}->{$option} = $params[0]; } # if print Dumper $self; unless ( exists $self->{CONFIG}->{$option} ) { Carp::croak "Error: \$handler->conf($option) not existing"; } # unless return $self->{CONFIG}->{$option}; } # conf