From: dkmd_nielsen Date: 2008-04-09T01:45:03+09:00 Subject: Re: Remove first and last items from array On Apr 8, 11:30 am, Mark Dodwell wrote: > Hi, > > I need to remove the first and last items in an array (which may have 1, > 2 or more items so the resulting array after removal may be empty). I > came up with this: > > a = [1,2,3,4,5] > 2.times { a.pop; a.reverse! } > > It works well, but do you think that there is a slightly less obscure > way!? > > Cheers, > > ~ Mark > -- > Posted viahttp://www.ruby-forum.com/. a.shift a.pop ?