use Foobar; sub doSomething { Foobar::some_method(); } #### my $f = Foobar->new(); $f->some_method(); #### sub class_or_instance { my $invocant = shift; if (ref($invocant)) { # got an instance (i.e., a "self" reference) } else { # got a class name (hopefully anyway ... 8-) } } ... Foobar->class_or_instance() # passes class name "Foobar" in as @_[0] my $f = Foobar->new(); $f->class_or_instance(); # passes object $f in as @_[0] #### Foobar::class_or_instance('blech');