in reply to ARGV behaviour in getopts std

Be careful about thinking that @ARGV is the number of members in the array. It can have a variety of meanings. Unless you are certain you understand the notion of context in Perl and how it affects the interpretation of @SOME_ARRAY it is best to be very explicit and use scalar @SOME_ARRAY instead. This will always be the number of members, whereas @SOME_ARRAY can have a variety of meanings depending on context.

Here is a brief summary of the different sigals and contexts that affect arrays in Perl:

Here are some examples of different contexts:

Replies are listed 'Best First'.
Re^2: ARGV behaviour in getopts std
by ysth (Canon) on Dec 22, 2010 at 10:13 UTC
    If you do funky things that change the starting index of the array
    but don't do that.
    --
    A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |
    Online Fortune Cookie Search