On Monday 12 July 2004 14:32, Markus Liebelt wrote:
>
> I now try to combine the two little programs in one program without
> redefining the way their methods work. The first just writes out its
> result by "puts ...", the second uses the variable $stdin. But how
> could a new method look that combines the two? I have no idea how to
> write it down. Is there something to "fork" the first one, so that
> the second one can read from standard input while the first writes to
> standard output?

IO.popen("-") do | pipe |
  if (pipe) then
    # in parent; communicate with child through pipe
  else
    # in child; communicate with parent through stdio
  end
end


	Sean O'Dell