but still do not understand how to fork a process and use my variables from my main process there aswell
The point is, you can't (directly). At the time of forking, all program data (including variables with their current values) are being duplicated, but from that point onwards, updates to the two copies of the variables do happen independently. It's for that reason that you'd then need IPC.
With threads and threads::shared, OTOH, you can tell Perl which variables you want to share across the different threads. But threads may be problematic in other ways, for example in that code (which you've loaded before creating a new thread) needs to be thread-safe — which in particular external libraries (as often needed with XS modules) sometimes aren't.
In reply to Re^3: Looping in the background of your main program
by almut
in thread Looping in the background of your main program
by Baphi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |