From: Eric Hodel Date: 2011-10-22T12:05:13+09:00 Subject: Re: global variable -- last expression On Oct 21, 2011, at 7:46 PM, Chad Perrin wrote: > On Sat, Oct 22, 2011 at 10:48:00AM +0900, Eric Hodel wrote: >> On Oct 21, 2011, at 5:34 PM, basha c. wrote: >>> In IRB the last expression is in _ . But if you are in a ruby program >>> how to get the last expression. >> >> You assign it to a variable: >> >> value = 1 + 1 >> >> puts "the value was #{value}" > > Mightn't that lead to some "shallow copy" problems in some cases? No more than in IRB.