sub recursion_test { my $array = shift; my @results; while(@$array > 1){ push @results, recursion_test($array); } return [$$array[0], undef]; }