in reply to need to read/write from/to an external program

thnx davorg

that works great!!.
I only don't understand how I should use the *Reader and *Writer together with 'use warnings' and 'use strict'.
For now (without strict and warnings) I have
#! /usr/bin/perl use FileHandle; use IPC::Open2; $pid = open2(*Reader, *Writer, "./progX" ); print Writer "X\n\n1\n2\n\n\n" ; { local $/ ; $inp = <Reader> ; } # or @inp = <Reader> close Writer, Reader ; print "Reader: $inp\n" ;

Replies are listed 'Best First'.
Re^2: need to read/write from/to an external program
by Sidhekin (Priest) on Feb 21, 2007 at 16:16 UTC

    You have the syntax for close wrong. It takes just one argument, so Reader is parsed as a bareword and not a filehandle. Simply:

    close Writer; close Reader;

    ... instead of trying to close both with one statement.

    print "Just another Perl ${\(trickster and hacker)},"
    The Sidhekin proves Sidhe did it!