in reply to Re: How to use getopt and $#argv together?
in thread How to use getopt and $#argv together?

That's because you pass in the opt variable, but don't define any options to search for.

325$ perl -MGetopt::Std -E'getopt(\%opts); say "@ARGV";' -- -f a -d b +-r -v a -d b -r -v 326$ perl -MGetopt::Std -E'getopt("fdrv",\%opts); say "@ARGV";' -- -f +a -d b > 327$

As Occam said: Entia non sunt multiplicanda praeter necessitatem.

Replies are listed 'Best First'.
Re^3: How to use getopt and $#argv together?
by ikegami (Patriarch) on Mar 09, 2011 at 23:15 UTC

    No, specifying the options doesn't change anything.

    $ perl -MGetopt::Std -E' getopt("fdrv",\%opts); say 1+$#ARGV; say "@ARGV"; ' -- -f a b c d 3 b c d

    The only thing you showed is that removing the arguments produces an empty @ARGV.