package MyClass; use strict; use warnings; use 5.010; sub new { my $self = {}; $self->{ObjA_ref} = shift; $self->{ObjB_ref} = shift; bless $self; return $self; } #### my $a_ref = ClassA->new(); my $b_ref = ClassB->new(); my $obj_ref = MyClass->new($a_ref, $b_ref); #### sub do_stuff { #this function is defined in MyClass $self = shift; $self->{ObjA_ref}->display_output("blah");