On Jan 7, 5:07 pm, [EMAIL PROTECTED] (Garhone) wrote:
> Hi,
>
> I'm looking at someone else's code. It goes like this:
>
> my $condfile="myfile.txt";
> open(COND, "|compile.pr > $condfile") or die "Can't fork: $!";
>
> What is happening with this filehandle, particularly, what does the
> "|" (pipe) facilitate in this case?

In a separate process, this program executes the compile.pr program.
Whatever is printed to the COND filehandle is fed as input to the
compile.pr process.   Whatever output compile.pr generates is
redirected to the file myfile.txt

In a "normal" open for writing:
open (COND, '> file.txt') or die ...;
whatever is printed to COND ends up in the file file.txt
In a pipe-open for writing:
open (COND, '| file.pl') or die ...;
whatever is printed to COND ends up as input to the file.pl process.

Paul Lalli


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to