in reply to Getopt::Std dies or returns empty var

You are using use strict;, but you want to use the $opt_var form of assignment.

The getopt routine can't assign to a myvariable that has it's scope in your code. Two possible solutions:

Replies are listed 'Best First'.
Re: Getopt::Std dies or returns empty var
by Abigail-II (Bishop) on Mar 11, 2004 at 13:35 UTC
    It quite misleading to mention "use strict". The OP's code isn't failing because of the "use strict" - it will still fail if you remove the "use strict". The problem is the lexical declaration of "$opt_u" - that one is not available to "Getopt::Std". Declaring the variable with "our" solves the problem, regardless whether "use strict" remains present or not.

    Abigail