timmyb85 has asked for the wisdom of the Perl Monks concerning the following question:

What is wrong with this? It isn't working, it gives me an error:
open (MPRINT, "|$mconn $ipconnect") || die "Can't open $mconn!\n"; .... .... close (MPRINT);
Notes: Any ideas?

Edited by theorbtwo: moved from Code for Perlmonks XML to RSS to Seekers of Perl Wisdom.

Replies are listed 'Best First'.
Re: problem spawning mconnect
by Hofmator (Curate) on Mar 31, 2004 at 13:23 UTC
    What error do you get? Try including the system error message like this: open (MPRINT, "|$mconn $ipconnect") || die "Can't open pipe to '$mconn': $!";

    -- Hofmator

      What is the difference between:

      open (MPRINT, "$mconn|") or die $!;

      and:

      open (MPRINT, "|$mconn") or die $!;

      ...$mconn is some unix program with parameters The first line works, the second one doesn't. I don't know what the difference is. I went to a web page, and they said it was the same thing, but if one works and the other doesn't...it seems like they aren't the same thing. Does anybody know the difference? Thanks timmyb85
        What is the difference between:   open (MPRINT, "$mconn|") or die $!; and:   open (MPRINT, "|$mconn") or die $!;

        The first executes the program in $mconn and you can read its output through the filehandle MPRINT.

        The second allows you to write some input through the filehandle MPRINT which the program in $mconn can access on its STDIN.

        -- Hofmator

      I found the error message, it is:

      connecting to host 123.456.78.90 (123.456.78.90), port 1234 connection open

      Any ideas about how to fix this error?