Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Parallel trigger of different subs

by karlgoethebier (Abbot)
on Jan 02, 2018 at 11:51 UTC ( [id://1206535]=note: print w/replies, xml ) Need Help??


in reply to Parallel trigger of different subs

"...2 sub's parallel in perl"

Consider something like this totally useless little sketch:

#!/usr/bin/env perl use strict; use warnings; use threads; use MCE::Hobo; use Data::Dump; use feature qw(say); use constant AMOUNT => 0; my $shared = MCE::Shared->hash(); my $nose = MCE::Hobo->new( \&nose, "cuke" ); my $foo = MCE::Hobo->new( \&foo, "bar" ); # $nose->join; # $foo->join; MCE::Hobo->wait_all(); my $hash_ref = $shared->export; dd $hash_ref; say $shared->{nose}; say $shared->{foo}; sub nose { sleep AMOUNT; $shared->set( nose => shift ); } sub foo { sleep AMOUNT; $shared->set( foo => shift ); } __END__

Best regards, Karl

«The Crux of the Biscuit is the Apostrophe»

perl -MCrypt::CBC -E 'say Crypt::CBC->new(-key=>'kgb',-cipher=>"Blowfish")->decrypt_hex($ENV{KARL});'Help

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (7)
As of 2024-03-29 09:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found