Perl error - called too early to check prototype

Perl Subroutine

One common error Perl beginners come through is : "main::fun() called too early to check prototype at file.pl"

You might have declared the function as:

sub fun() {
}

Correct way to declare it is

sub fun {
}