tricky stdout

Discussion in 'Perl Misc' started by George Mpouras, Dec 23, 2013.

  1. I use the s1.pl to feed with data the s2.pl
    is there any way s1.pl to catch back the output of s2.pl ?

    # s1.pl
    open SHELL, '|-', './s2.pl' or die "Could not run shell $?\n";
    print SHELL "$_\n" foreach 'a1', 'a2', 'a3';
    close SHELL;

    # s2.pl
    while (<STDIN>) {
    chomp $_;
    print STDOUT "s2 $$ received \"$_\"\n" }
    George Mpouras, Dec 23, 2013
    #1
    1. Advertising

  2. George Mpouras <> wrote:
    >I use the s1.pl to feed with data the s2.pl
    >is there any way s1.pl to catch back the output of s2.pl ?


    perldoc -q pipe
    "How can I open a pipe both to and from a command?"

    jue
    Jürgen Exner, Dec 23, 2013
    #2
    1. Advertising

  3. Στις 23/12/2013 17:47, ο/η Jürgen Exner έγÏαψε:
    > "How can I open a pipe both to and from a command?"


    use IPC::Open2 is doing the trick , thanks
    George Mpouras, Dec 23, 2013
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jim Schueler

    Tricky AUTOLOAD behavior

    Jim Schueler, Aug 25, 2004, in forum: Perl
    Replies:
    1
    Views:
    434
  2. Elad
    Replies:
    0
    Views:
    403
  3. Replies:
    9
    Views:
    522
    CBFalconer
    Apr 25, 2006
  4. Andreas S
    Replies:
    3
    Views:
    246
    Eric Hodel
    Dec 9, 2006
  5. Replies:
    2
    Views:
    320
    A. Sinan Unur
    Dec 7, 2005
Loading...

Share This Page