in reply to Can @ARGV work within Perl functions or is it just for script input?
Note, also, that the context of the my $argument_size = scalar(@ARGV); statement is unclear (the closing brace for either sub doesn't appear to be present), butsub foo { local @ARGV = @_; . . . }
may well produce the results you (seem to have) expected.sub verify_function_params { my $num = $_[0]; my $function_name = $_[1]; my $input = $_[2]; my $type = $_[3]; my $argument_size = scalar(@_); print "argument_size is $argument_size\n"; . .
Now, understanding the above, you will probably be able to see why...
is usually written as...sub verify_function_params { my $num = $_[0]; my $function_name = $_[1]; my $input = $_[2]; my $type = $_[3]; . .
sub verify_function_params { my ($num, $function_name, $input, $type) = @_; . .
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Can @ARGV work within Perl functions or is it just for script input?
by jdporter (Paladin) on Feb 09, 2009 at 20:30 UTC | |
by jasonk (Parson) on Feb 10, 2009 at 16:46 UTC | |
|
Re^2: Can @ARGV work within Perl functions or is it just for script input?
by johngg (Canon) on Feb 09, 2009 at 20:39 UTC |