From: [email protected]
=> [“a”, “b”, “c”, “d”, “e”, “f”]
irb(main):005:0> [1,3,5].each {|e| a.slice!(e) }
=> [1, 3, 5]
irb(main):006:0> a
=> [“a”, “c”, “d”, “f”]You’d probably want to reverse the list of indices.
Or perhaps:
irb(main):001:0> a = %w{a b c d e f }
=> [“a”, “b”, “c”, “d”, “e”, “f”]
irb(main):002:0> [1,3,5].each{ |e| a[e] = nil }
=> [1, 3, 5]
irb(main):003:0> a.compact
=> [“a”, “c”, “e”]
Remembering, of course, that the 1st line is the 0th line number.