Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Do I need threads?

by BrowserUk (Patriarch)
on Dec 20, 2011 at 21:11 UTC ( [id://944476]=note: print w/replies, xml ) Need Help??


in reply to Do I need threads?

You don't necessarily need threads, but you can certainly use them to good effect.

use threads; ## start the first command going my $t1 = async { return qx[ ... ]; }; ## Start the second command running. my $t2 = async { return qx[ ... ]; }; ## wait for the first to finish and retrieve the output my $output1 = $t1->join; ## wait for the second to finish and retrieve the output my $output2 = $t2->join;

Doing that in a loop rather than separately is quite trivial.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2025-11-11 04:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (67 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.