Because you're calling main in some place of the file before you define it with sub main (..). That call up there is not being prototype checked. Please note that "prototypes" in Perl are not what you very probably think they are. You should consider not using them. See a recent discussion as well as Tom Christiansen's exhaustive explanation about them.