http://www.perlmonks.org?node_id=878398


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: