in reply to Problem with passing array in a sub

If @test is a 2d array, then passing $test[2] to the subroutine passes an array reference, not an array. To pass the array, you have to dereference it:
@a = permutations(@{ $test[2] });

See perllol - Manipulating Arrays of Arrays in Perl for details.

لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ