Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

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

by exilepanda (Friar)
on Dec 30, 2012 at 10:16 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1010905]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (2)
As of 2024-04-25 05:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found