package AAA; use lib ('.'); use BBB; use Exporter 'import'; our @EXPORT = qw /$bbb/; our $bbb=BBB->new(); 1; #### package BBB; use lib '.'; use AAA; use feature 'say'; sub new{ my $class=shift; my $self=bless {},$class; return $self; } sub hello{ my $self=shift; say 'hello'; } sub hello2{ my $self=shift; $b->hello(); } #### #!/usr/bin/env perl use strict; use warnings; use lib (','); use AAA; use BBB; $bbb->hello; 1; #### package BBB; use lib '.'; use feature 'say'; sub new{ my $class=shift; my $self=bless {},$class; return $self; } sub hello{ my $self=shift; say 'hello'; } sub hello2{ my $self=shift; $b->hello(); } use AAA; #### package AAA; use parent('Exporter'); our @EXPORT=('$bbb'); our $bbb=BBB->new(); package BBB; use AAA; use feature 'say'; sub new{ my $class=shift; my $self=bless {},$class; return $self; } sub hello{ my $self=shift; say 'hello'; } sub hello2{ my $self=shift; #$b->hello(); #what is $b? $bbb->hello(); } package main; use AAA; $bbb->hello2();