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. Advertisements

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

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

  3. Στις 23/12/2013 17:47, ο/η Jürgen Exner έγÏαψε:
    use IPC::Open2 is doing the trick , thanks
     
    George Mpouras, Dec 23, 2013
    #3
    1. Advertisements

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.