use warnings; use strict; use lib '.'; use Foo qw(:all); # Call as function function_or_method('1', 'function'); # Call as method my $obj = Foo->new; $obj->function_or_method('2', 'method');