#!/usr/bin/perl use warnings; use strict; use Foo; # some "forward declaration" syntax instead of looking for Foo.pm? sub new { print "haha"; return; } my $a = new Foo; $a->hello; package Foo; sub new { return bless {},shift; } sub hello { print "hello"; }