Perl: the Markov chain saw | |
PerlMonks |
Re: Re: What is a pipe and why would I want to use one?by fsn (Friar) |
on Jul 10, 2002 at 18:30 UTC ( [id://180827]=note: print w/replies, xml ) | Need Help?? |
This is a very very simple (and probably Linuxcentric) attempt to illustrate how you can send data from one program to another using a pipe: ./Daddy.pl:
./Kiddy.pl:
There are some extra fluff in Kiddy.pl, the use of chomp and $in instead of $_ f.ex., but I kept it there to make it more clear, at least to me. If you run the above you would get this:
$ ./Daddy.pl By Kiddy.pl: Testing IPC with pipes. Line 1. By Kiddy.pl: Testing IPC with pipes. Line 2. By Kiddy.pl: Testing IPC with pipes. Line 3. By Kiddy.pl: Testing IPC with pipes. Line 4. By Kiddy.pl: Testing IPC with pipes. Line 5. By Kiddy.pl: Testing IPC with pipes. Line 6. By Kiddy.pl: Testing IPC with pipes. Line 7. By Kiddy.pl: Testing IPC with pipes. Line 8. By Kiddy.pl: Testing IPC with pipes. Line 9. By Kiddy.pl: Testing IPC with pipes. Line 10. $ Note that Daddy.pl is not printing to the screen at all, Kiddy.pl is doing all that.
In Section
Seekers of Perl Wisdom
|
|