From: Lloyd Linklater Date: 2007-10-19T14:12:52+09:00 Subject: Re: array help Jeremy Woertink wrote: > I have [1,2,3] and I want to return [1,2] is there already a method > that does this? > > irb(main):001:0> [1,2,3] > => [1, 2, 3] > irb(main):002:0> [1,2,3].pop > => 3 > irb(main):003:0> [1,2,3].everything_but_the_one_thing_that_pop_returns > I am not sure if you got your answer yet or not, so here goes. What you are seeing is the result of the pop, i.e. what was popped. What you want is the array AFTER the pop. This is how it goes: a = [1, 2, 3] p a.pop # 3 <= this is what was popped off p a # [1, 2] <= This is what is left. use the array at this point. -- Posted via http://www.ruby-forum.com/.