in reply to Problem dup'ing STDOUT

You should be using exec instead of qx//

Replies are listed 'Best First'.
Re: Re: Problem dup'ing STDOUT
by nimdokk (Vicar) on Nov 26, 2003 at 16:48 UTC
    Perhaps, but when I read in the Camel Book about exec, it indicates that "The exec function terminates teh current program and executes an external command and never returns!!! Use system instead of exec." I do not want the program to terminate, I need to retain control to do other things. Perhaps my example wasn't as explicit as it should have been.


    "Ex libris un peut de tout"
      Does exactly the same thing as "exec LIST", except that a fork is done first

      From system documentation. It is equivalent to a fork/exec, just more efficient.

      The point is that qx// returns the output as a scalar or array but does not explictly print anything to STDOUT (as it used to be in the old days in null context apparently).

      Use system instead of exec.
      Like it says; just use system instead of exec (or qr//) and you'll be allright.

      Joost.

      -- #!/usr/bin/perl -w use strict;$;= ";Jtunsitr pa;ngo;t1h\$e;r. )p.e(r;ls ;h;a;c.k^e;rs ";$_=$;;do{$..=chop}while(chop);$_=$;;eval$.;
        Not quite. According to my copy of the Camel Book, under system() it says:
        To capture the output from a command, use backticks or qx//."

        Which is what I had been doing.


        "Ex libris un peut de tout"