in reply to Re^2: IPC::Run and subprocess interaction
in thread IPC::Run and subprocess interaction

During my Internet browsing I didn't find any example with 2 pumps.

Only one is needed. This would do:

$TOK_IN = $line; pump $TOK while $TOK_OUT !~ /\n\z/; print "out: $TOK_OUT"; $TOK_OUT = '';

This one is in the docs.

$TOK_OUT doesn't seem to be an ordinary variable.

Change chomp to s/\r?\n\z//.

Replies are listed 'Best First'.
Re^4: IPC::Run and subprocess interaction
by xhudik (Initiate) on Jul 18, 2011 at 15:24 UTC
    yes, this is exactly what I needed - thank you

    The strange thing is that cat program is giving \r\n instead of \n as EOL. For what reason \r is there? Normal(in bash), cat is writing just \n ...

    cheers, Tomas
      One would presume that the input to cat has carriage returns before the newlines.