
KevinR
Veteran

Jun 12, 2009, 11:23 AM
Views: 801
|
|
Re: [tushar] if ($#ARGV != 0) what does it suggest
|
|
|
When you pass arguments to a perl script from the command line they are stored in the @ARGV array. "$#name" is the numeric value of the last index of an array, $#ARGV is the value of the last index of the @ARGV array. Perl arrays start at index 0 (zero) so if the value of $#ARGV is not zero: it means the array has more than one element in it or none (its empty). Logically its better written like so: Which means the length of the array is one, which is what you want. If its not one then evaluate the block and return the error. Why you posted this in the Advanced forum though is odd. Post beginner questions in the Beginner forum please. -------------------------------------------------
(This post was edited by KevinR on Jun 12, 2009, 11:24 AM)
|