i've got a function, into which i want to be able to pass a list of lists, like in this artificial example:
sub print_lists(@input) {
.say for @input
}
my @list_of_two_lists = ((1, 2), (3, 4));
print_lists(@list_of_two_lists);
this gives the following output, as expected:
(1, 2)
(3, 4)
but if i do this:
my @list_of_one_list = ((1, 2));
print_lists(@list_of_one_list);
i get this output:
1
2
i.e. it flattens the list containing one list of two elements, into a single list of two elements.
what am i doing wrong? what do i need to do if i want to be able to pass in a list containing a single list?