I was reading some questions regarding the $@ global variable and how it can be clobbered before it's even handled due to successful evals wiping it clean.
But what if it gets clobbered by an error occurring in a concurrent thread? The new threads package says stuff isn't shared by default, which means it's one of the few mainstream languages that makes '$a = $a;' deterministic by default (and to think that people say C# and Java are better than Perl in large projects). But I'm not sure about special global variables.
My gut's instinct says they're just like any other variable, thus they won't be shared. My brain's instinct says 'let's check with the wizards on Stackoverflow'.
I checked the threading tutorial on Perldoc, and it covers normal variables in the sharing section, but then seems to move on without covering special variables.
Can I use the special variables without risk of them being clobbered by other threads, even if I don't localize them first? E.g. can I pull a value out of $@ without worrying about errors occurring in parallel threads?
your guts are right, they are not shared!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With