in reply to Strange behavior by Perl: Too many arguments for...

In your first example, _validate is called before it is defined. That isn't a problem as perl performs a compilation pass of your code before it executes it (oversimplified, I know).

Your second example is the other way way round. The compiler sees your definition, and its prototype - the empty brackets before the brace in "_validate() {". That prototype says that _validate must be called with no arguments. However, your subroutine call has one argument: $login.

Removing the empty parentheses from your function definition will solve your problem:

sub _validate {