use strict; use warnings; use 5.012; package Dog; sub new { my $class = shift; my $self = {}; bless $self, $class; } sub bark { say 'woof'; } sub do_math { say '2 + 2 = 4'; } package main; sub func1 { my $obj = shift; $obj->do_math(); } sub func2 { my $obj = shift; $obj->bark(); func1($obj); } my $dog = Dog->new(); func2($dog); --output:-- woof 2 + 2 = 4