Can you tell me how to use eval on this code?
To achieve what?
How can I restart thread a thread if it died with same thread Id?
You cannot. Thread ids are allocated by the system and are not re-used.
If you need a number within your threads that you assign, just pass it in as a parameter:
for my number (0 ..3)) { my $thr = threads->create ( sub { my $numberPassedIn = shift; worker(); }, $number )->detach(); }
In reply to Re^5: Scope of thread variable
by BrowserUk
in thread Scope of thread variable
by mr_p
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |