in reply to inserting a new line after some elemnts in an array

Use modulo arithmetic to decide which elements are even:

for my $i (0..$#array) { print $array[$i]; print "\n" if $i % 2 == 0; }
Change the details to match your specific problem, but using % is usually what you want.