From: Devin Mullins Date: 2005-09-22T19:45:20+09:00 Subject: Re: hi, i'm new. plus one question Daniel Sheppard wrote: >pop (and it's cousin 'shift') can't return a new array, because they're >busy returning the last (or first) element of the array. > > Well.... class Array def pop_ ary = dup [ary.pop, ary] end def shift_ ary = dup [ary.shift, ary] end end a = [1,2,3,4] n, b = a.pop_ #=> [4, [1, 2, 3]] n #=> 4 b #=> [1, 2, 3] a #=> [1, 2, 3, 4] Devin