in reply to Redirecting STDOUT to a variable

You can open a handle similar to a file handle like:

open (STDOUTHANDLE, "somecommand|"); while ($line = <STDOUTHANDLE>) { # . . . }

note the pipe character at the end of the command.