Is it possible to pass two lists to a sub in Perl, for example:
sub Foo {
my(@list1,@list2) = @_;
}
I know I could make @_ two lists, with each sublist being the desired argument, I’m just wondering if there is a cleaner way
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well if you want two arrays you could use a prototype:
But there are many ways to get around prototypes, and I prefer to avoid them in most places. You can simply skip the prototype and manually pass references:
If you haven’t worked with references at all, check out perlreftut for a nice tutorial.