in reply to Re^3: Set env variables as part of a command
in thread Set env variables as part of a command
When I fork the program I execute I need to create an array. I need to return that array to the parent process. How would one do that?
By serialising and unserialising. Create the array in the child process, write it to a file handle of a pipe, and read that pipe in the parent process. Perl wraps that in open('-|') / open('|-') See perlipc, especially section "Safe Pipe Opens". For simple arrays of simple strings not containing control characters, writing each string on a new line might be sufficient. Otherwise, use Storable, JSON, XML, YAML or something like that.
Update: You might need to fork once again from your first child to be able to "return" an array after the external program has finished.
Alexander
|
|---|