in reply to Perl forked processes and variable sharing

Pardon me for not looking into your code ...

... but AFAIK there shouldn't be any way that a process can change data inside another process.

And that is what fork is doing, creating different processes!

(however in a very efficient way by duplicating code with copy-on-write tricks, IIRC)

The "identical reference" you are seeing is IMHO just an identical copy of the reference, NOT the same memory address (NB: refs are not memory addresses! )

Why don't you use proper perlipc or threads with shared data instead?

Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery

  • Comment on Re: Perl forked processes and variable sharing

Replies are listed 'Best First'.
Re^2: Perl forked processes and variable sharing
by fireblood (Scribe) on Feb 02, 2022 at 00:59 UTC
    Hi Rolf,

    Thanks for the feedback, and especially for your last line suggesting using proper perlipc or threads with shared data. I was aware of threads with shared data, but had not read Tom Christiansen's amazing treatise on Perl IPC until reading your reply. It's definitely got me going in a new direction that I think will work properly for me.

    Cheers, Richard