open($fh, '-|', 'some cmd to read from') or die '...'; while (<$fh>){ # read one line of output }