The forked child process is meant to return the content, not to the parent process, but to the connected client. The exit causes all open file handles to be flushed and closed. Thus the content is delivered to the client.
Without the exit, the forked child would continue to execute the parent's code after returning from the anonymous sub.
perl -le'print map{pack c,($-++?1:13)+ord}split//,ESEL'
| [reply] |
And because the filehandles which are sshared have been opened by the parent still at large are shares with the child so when closing up with exit the stdout is delivered to the client/browser?
| [reply] |
Apologies, had no time earlier. Answer updated. And thanks shmem for jumping in in the meantime!
The way forward always starts with a minimal test.
| [reply] |