From: Stephen White Date: 2000-09-03T18:23:35+09:00 Subject: [ruby-talk:4757] Re: Piping in Ruby? On Sat, 2 Sep 2000, Dave Thomas wrote: > > I've had a brief look through Ruby's syntax, and it appears that > > it's possible to assign different inputs and outputs, but nothing as > > quick and easy as the '|' convention used in shells. > > Could you give an example of how you'd use this in Ruby? Currently, I keep repeating this construct: a = [] list.scan(pattern) {|i| a << convert(i) } a.each {|i| code } whereas I'd like to do: list.scan(pattern) {|i| convert(i) } | each {|i| code } instead. Eg, I don't need the intermediate 'a' array. Thanks. :) -- steve@deaf.org