In message "[ruby-talk:9439] array.each_index_but_last ?"
    on 01/01/18, Hugh Sasse Staff Elec Eng <hgs / dmu.ac.uk> writes:
>What is the idiomatic Ruby way to go through all the elements of an array,
>except the last one, gettting the index?

How about this:

  my_array[0..-2].each{....}

Or, 

  last = my_array.pop
  my_array.each{....}
  my_array.push last

where my_array is huge and {....} doesn't change my_array. 

-- Gotoken