Andy Elvey wrote:
>

arr1 = [1, 2, 3, 4, 5]
arr2 = ["foo", "bar", "baz", "abc", "def"]

resultA = arr1.zip(arr2).flatten

resultB = []
arr2.each do |item|
  resultB << "|" << item
end
resultB << "|"

resultC = []
arr2.each do |item|
  resultC << item << "|"
end
resultC.pop()

p resultA
p resultB
p resultC


--output:--
[1, "foo", 2, "bar", 3, "baz", 4, "abc", 5, "def"]
["|", "foo", "|", "bar", "|", "baz", "|", "abc", "|", "def", "|"]
["foo", "|", "bar", "|", "baz", "|", "abc", "|", "def"]


-- 
Posted via http://www.ruby-forum.com/.