Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?

Re: Parallel trigger of different subs

by karlgoethebier (Monsignor)
on Jan 02, 2018 at 11:51 UTC ( #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?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1206535]
and the voices are still...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2018-07-20 10:07 GMT
Find Nodes?
    Voting Booth?
    It has been suggested to rename Perl 6 in order to boost its marketing potential. Which name would you prefer?

    Results (427 votes). Check out past polls.