I have a Perl file like this:
use strict;
f1();
sub f3()
{ f2(); }
sub f1()
{}
sub f2()
{}
In short, f1
is called before it is defined. So, Perl throws a warning: "f1 called too early to check prototype". But same is the case with f2
, the only diff being that it is called from inside another subroutine. It doesn't throw a warning for f2
. Why?
What is the best way to resolve this issue?
- declare the subroutine before it is called
- call the sub like this:
&f1();