in reply to Creating a Pipe

Several issues.

  1. you are doing 2 forks.
  2. you confounded parent and child code. The child writes to, the parent reads from the pipe.
    if ($pid = fork) { # parent ... } elsif ($pid == 0) { child ... exit; }
  3. don't forget to exit the child in the elsif branch to stop it executing any following code of the parent.
  4. you need a signal handler in the parent for it to get notified about the child having exited.
    Otherwise the parent will try to get a line from its pipe handle when there isn't any.

Last, you need loops in the parent and the child functions for the repeating to happen.

Try to fix your program first, then read the spoiler ;-)

perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'