I have run into a situation several times at my current job where the location of a perl function affects whether it works or not. I've never had this happen before and feel like I'm missing something obvious. The current scenario happens on both Windows (Strawberry Perl) and UNIX (Solaris v5.8.4). I have a function called PostValidate with one argument. When I put the function definition AFTER the main body of code, it runs; when I put the function before, it fails with
Too many arguments for main::PostValidate at y.pl line 349, near "$ofile)"
The call within the main body looks like this:
if ($validate) {
PostValidate($ofile);
}
I don't have any prototypes defined and I'm really at a loss as to why it should matter where the function is. Any ideas?