in reply to bit of help with map function

Others have already commented on better ways to achieve what you want. Let me try to explain your mistake:

my @names = map {$i > 6 ? push(@names,$input2arr[$i]) : $i++ } @input2arr;

pushing to the array @names inside the map block is wrong. Because map aggregates all return values from the block, and then assign them to @names, so all your previous changes are lost.

Or phrased differently, if you just return those elements, map will do the pushing for you.