my $main = bless{}; # als Beispiel einer Instanz # foo soll im Scope der main afgerufen werden $main->execute('foo'); sub execute{ my $self = shift; my $name = shift; # entweder haben wir die sub im eigenen Scope # oder wir binden sie als CodeRef ein if( my $code = $self->can($name) ){ $self->$code(@_) } else{ my $codehash = do 'lib.pl'; if( my $coderef = $codehash->{$name} ){ $self->$coderef(@_); } } }