"Robert Klemme" <bob.news / gmx.net> writes: > Damien Wyart wrote: >> Many thanks to everyone who responded, the answers are very >> interesting and enlightening ! > > As far as I can see noone used the Hash with block feature. So here it > is: > > ruby -e 'h=Hash.new(){|ha,l| puts l;ha[l.freeze]=1};ARGF.each {|l| h[l]}' Or, using my favorite unknown Hash method, fetch with a block: ruby -ne '($h||={}).fetch($_){puts $h[$_]=$_}' > robert -- Christian Neukirchen <chneukirchen / gmail.com> http://chneukirchen.org