From: Andy Elvey Date: 2009-02-18T17:47:25+09:00 Subject: Newbie - several array questions Hi all - I'm a first-timer and very much love Ruby! I have several questions involving arrays. First, I'll create a couple of arrays to use in my examples - arr1 = [1, 2, 3, 4, 5] arr2 = ["foo", "bar", "baz", "abc", "def"] What I want to do is the following - a) I want to create another array that alternates the elements of these two arrays, like this - [1, "foo", 2, "bar", 3, "baz", 4, "abc", 5, "def] b) In order to be able to create text tables, I'd like a function that can take a character (like "|") and can apply it to an array so that you end up with another array like this - arr4 = ["|", "foo", "|", "bar", "|", "baz", "|"] c) Finally, I'd like to create another function to do a very similar thing to (b), but only have the character *between* the elements, like this - arr5 = ["foo", "|", "bar", "|", "baz"] Very many thanks in advance for your help! (Many thanks to Matz too for a great language! :) ) - latte -- Posted via http://www.ruby-forum.com/.