From: "Florian Groß" Date: 2005-08-11T05:43:47+09:00 Subject: Re: anonym variable $_ and foreach similar in Ruby ? David A. Black wrote: >> And the general form for guys who are too lazy to pass along arguments: >> >> [1, 2, 3].each(&method(:puts)) >> >> But I think ary.each { |e| puts e } is the Ruby way. > > I don't; I advocate doing > > puts ary > > and let Ruby do the work :-) I know, I know... it's not as explicit > in its handling of each element. But once someone tells you how it > works, you know; and I think learning that is one of the Ruby rites of > passage (like learning that #{...} interpolates more than variables > :-) In this case I would also use puts ary, of course, but there is cases like %w(foo bar qux).each { |file| require file } where you would also be able to do %w(foo bar qux).each(&method(:require)) In that case I would still prefer the more explicit block form. Sorry, if that didn't come out too clear in my previous post.