Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Trouble getting started with fork

by pajout (Curate)
on Mar 04, 2010 at 19:30 UTC ( #826790=note: print w/ replies, xml ) Need Help??


in reply to Trouble getting started with fork

Here is my stupid solution. It could fit your requirements if I understand well...

use strict; use warnings; # use this array to simulate 10 tasks my @array = qw(zero one two three four five six seven eight nine ten); for (1..5) { my $pid = fork(); next if $pid; test(2*$_-1); test(2*$_); exit(0); } print "Done\n\n"; sub test { my $work_on_index = shift; # do the work here print "text=$array[$work_on_index]\n"; sleep 1; }


Comment on Re: Trouble getting started with fork
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (8)
As of 2014-07-23 23:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (154 votes), past polls