in reply to Predefining sub Parameters
So by the first option, it should be:
That code would be called like: functionname("string",['array_item1', $arrayItem2, '...'], "other_string_param");sub functionname { my ($string_param, $array_param_ref, $other_string_param) = @_; my @array_param = @$array_param_ref; # do something with parameters, return values }
Or, you could put it at the end:
where it'll slurp up all remaining args. And that code would be called like: functionname("string", "other_string_param", 'array_item1', $arrayItem2, '...');sub functionname{ my ($string_param, $other_string_param, @array_param) = @_; # do something with parameters, return values }
Hope that helps.
|
---|