From: Josselin Date: 2007-02-25T04:05:05+09:00 Subject: Re: using step backward ? On 2007-02-24 19:51:16 +0100, "Phrogz" said: > On Feb 24, 10:59 am, Josselin wrote: >> I have an array myArray = ["22", "31", "56", "89", "47"] >> >> I would like to produce a string like : "22#31#56#89>47<" where the >> last item must be : >last_item< > > irb(main):001:0> myArray = ["22", "31", "56", "89", "47"] > => ["22", "31", "56", "89", "47"] > irb(main):002:0> last = myArray.pop > => "47" > irb(main):003:0> myArray.join('#')+">#{last}<" > => "22#31#56#89>47<" thanks it runs well for 1or n > 2 items but not for 2 items myArray = ["22", "31"] => ["22", "31"] irb(main):002:0> last = myArray.pop => "31" irb(main):003:0> myArray.join('#')+">#{last}<" => "22>31<" I should get "22#>31<", the # must come after each item excepted the last..