From: Emmanuel Touzery Date: 2002-12-03T23:16:52+09:00 Subject: Re: Conditional block operations Shannon Fang wrote: > Hi, > >> From: "Roman Rytov" >> Reply-To: ruby-talk@ruby-lang.org >> To: ruby-talk@ruby-lang.org (ruby-talk ML) >> Subject: Conditional block operations >> Date: Tue, 3 Dec 2002 22:58:15 +0900 >> >> Is there a way to filter results of EACH or COLLECT functions? Let's say >> in >> >> file.each do |line| >> a, b = line.split(pattern) >> End > > > I think for this case, the easist way might be > > file.each do |line| > a, b = line.split(pattern) if line !~ /^\s*$/ > end grep could help, unfortunately I don't know if it can be negated (eg "all but the matches"). emmanuel -- "If someone breaks into my house and steals my CDs, who calls the cops, me or the music industry? If it's me, then that's my property." --Ruben Safir