Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: How to share complex data structure in threads ?

by exilepanda (Monk)
on Dec 30, 2012 at 10:16 UTC ( #1010905=note: print w/ replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    push @s, &share( { $cmd => time } }; ## The & before share() is import
    +ant here; and one of the few times you should ever use it.
    ## or
    ...
    ## or 
    my %hash : shared = ( $cmd => time() );
    push @s, \%hash;
    
  2. or download this
    my @array : shared;
    $array[ 0 ] = 'fred'; ## ok
    ...
    $array[ 3 ] = { 'a'..'z' }; ## NOT OK
    my %hash : shared = ( 'a' .. 'z' );
    $array[ 3 ] = \%hash; ## OK
    
  3. or download this
    $World = { 
      Players => [ 
    ...
        ]
      }
    }; 
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1010905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2014-09-20 01:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (151 votes), past polls