Where is the standard output coming from in the following program

G

grocery_stocker

Given the following...

m-net% more bbs.pl
#!/usr/bin/perl

use strict;
use warnings;

open my $out, '|-', 'bbs' or die "cannot open pipe to bbs";

print $out "find nope a=cdalten\n";

close $out or die "cannot close pipe to bbs: $!";

it produces....

m-net% ./bbs.pl
YAPP 3.1.1 Copyright (c)1995 Armidale Software
Registered to: Arbornet

Welcome to the
February General Conference


fairwitness: jerryr

41 newresponse items and 9 brandnew items
First item 1, last 80
No matches found.

Now leaving February General...
m-net%


The question is, where is the standard output coming from? The child
process?
 
T

Tim Greer

grocery_stocker said:
open my $out, '|-', 'bbs' or die "cannot open pipe to bbs";

print $out "find nope a=cdalten\n";

Going by that code, you've sent the command to (and get the output from)
the child process.
 
T

Tim Greer

Tim said:
Going by that code, you've sent the command to (and get the output
from) the child process.

Pardon, I worded that poorly. Greg's explanation of the child process
inheriting the output from the parent process is a better way of
wording it (my reply makes it sound like it is inherited by the parent
from the child -- bad wording... oops).
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,997
Messages
2,570,241
Members
46,831
Latest member
RusselWill

Latest Threads

Top