my @val; if(...){ for(my $x=0;$x<(@PA_ARRAY_FKT-2);$x++) { $val[$x] = @{$arr->[$x]}; print "\n1: val[$x] = ".@{$arr->[$x]}."\n"; @add = (\@val); } else { for(my $x=0;$x<@add;$x++) { unshift( @{$arr}, [ @{$add[0]} ], [ @{$add[1]} ]); } }