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 d
The lack of a warning on the call to f2()
from f3()
appears to be a bug.
use strict;
use warnings;
f1();
sub f1 {
my @a = qw(a b c);
f2(@a);
}
sub f2(\@) { print $_[0] }
This prints "a". If you either predeclare f2()
or swap the order of the subroutine definitions, it prints "ARRAY(0x182c054)".
As for resolving the situation, it depends. My preferences (in order) would be:
&foo()
notation to bypass prototype checking.