From: "Florian Groß" Date: 2005-08-11T05:12:22+09:00 Subject: Re: anonym variable $_ and foreach similar in Ruby ? James Edward Gray II wrote: >> In perl >> print $_, "\n" foreach (@array); >> Are there other ways than those two array.each? > > Or: > > array.each { |e| puts e } > > Or just: > > puts array > > I like that better than Perl, but you decide... ;) 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.