in reply to range operators

The push operator can take a list in the second argument. What you want is a slice of @old_array:

push @new_array, $count > @old_array ? @old__array : @old_array[0 .. $count-1];
That checks the size of @old_array to see if it has at least $count elements. If less or equal, the whole array is pushed without padding, otherwise the slice of the first $count elements is pushed.

After Compline,
Zaxo