in reply to Re: Getopt - Validate arguments before processing -- BEGIN
in thread Getopt - Validate arguments before processing

The code in the BEGIN block runs before Perl has even seen your declaration of the subroutine sub first { .... To work around that, you need to move the BEGIN block below the subroutine declaration(s).

Replies are listed 'Best First'.
Re^3: Getopt - Validate arguments before processing -- BEGIN
by Discipulus (Canon) on Jan 31, 2022 at 09:03 UTC
    yes thanks Corion, I know that.. but probably I have expressed it poorly :)

    > (but I moved the help sub on top, so it is parsed before the BEGIN block, so it can be called: you must move other subs to give them a chance to be called)

    I just wanted to suppress the warning but I was not able to find its category, and neither no warnings suppresses it

    L*

    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

      It's not a warning. It's a fatal error which GetOptions apparently catches and converts to a warning. And Corion told you how to fix it.