From: nobu.nokada@... Date: 2003-07-10T23:36:01+09:00 Subject: Re: Ruby T-Shirt Idea Hi, At Thu, 10 Jul 2003 15:26:14 +0900, Daniel Carrera wrote: > Okay, so we agree on: > > re = ARGV.shift; > ARGF.each{|x| puts x if x =~ /#{re}/} > > It's Rubyish, and it avoids the perlishms like "$<" (akward variable names) and the "and". > A slight modification would be: > > re = ARGV.shift; > puts ARGF.map{|x| x if x =~ /#{re}/}.compact They waits until all input end. ARGF.grep(Regexp.new(ARGV.shift)) {|l| puts l} or ARGF.grep(Regexp.new(ARGV.shift), &method(:puts)) -- Nobu Nakada