title: How can I share object between threads in Perl?
body: <p>I have searched for related topic, but still can't solve the problem...</p>
  
  <pre><code>use threads;
  my $person = new Person( 'Name' =&gt; "yy");
  
  my $udp_thread = threads-&gt;new(\&amp;udp_func);
  
  while(1)
  {
      $person-&gt;working();
  }
  
  sub udp_func 
  {
      #Can't call method "setName" on an undefined value:
      $person-&gt;setName();             
  }
  </code></pre>
  
  <p>How can I visit the object $person in the new thread ? Thanks very much!!</p>