From: James Edward Gray II Date: 2005-08-11T04:54:26+09:00 Subject: Re: anonym variable $_ and foreach similar in Ruby ? On Aug 10, 2005, at 2:46 PM, ngoc wrote: > Hi > In perl > print $_, "\n" foreach (@array); > In Ruby > array.each { |e| print e, "\n" } > or > array.each do |e| print e, "\n" end > > So |e| is similar to $_. But I can not > say > { |e| print e, "\n"} array.each > > because of block as argument and OO issue. In addition, it looks a > little bit complicated in Ruby. I think in THIS CASE perl is more > elegant than Ruby? > > Is it a right thinking (IN THIS CASE)? > 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... ;) James Edward Gray II