in reply to ( my ($argCount,@argValues) = @_ ) == Bad Idea?
To explicate the wisdom offered above:
You were lead to believe that you could get the number of arguments and the arguments with the following:
my ($argCount, @argValues) = @_;
Unfortunately, you were misled. Someone confused Perl with the way a C main() routine gets its arguments from the command line.
Perl gets its subroutine arguments passed in the @_ array. So, to get the argument values for your subroutine, do this:
my (@arguments) = @_;
To get the number of items in a perl array, call it in a scalar context. So:
my (@arguments) = @_; my $argument_count = scalar(@arguments);
No separate $argumentCount variable is needed, since Perl arrays know their own lengths.
Good luck. We're all counting on you.
|
|---|