From: Love U Ruby Date: 2013-04-02T22:36:28+09:00 Subject: Re: Recursion with Hash Scott M. wrote in post #1104067: > Joel Pearson wrote in post #1104066: >> In case Scott's answer isn't what you were looking for: > If you let us know why you need to return the whole array, we might have > more to add. Actually I need the last element to be replaced,and after the update I will add `each_with_object` on that updated array. If it possible then I could do write one liner,otherwise I need to do the job in Break. Thus I am looking for a direct function or a one liner to do the same. Here is something I have tried till now: >> [1,2,3].tap{ |arr| arr[-1] = 12 } => [1, 2, 12] any small code from you experts? -- Posted via http://www.ruby-forum.com/.