# Make all the form submissions happen at same instant. Wait until # every thread finishes their initial requests and processing before # submitting. use Coro 'async'; use LWP::Protocol::AnyEvent::http; BEGIN { *CORE::GLOBAL::sleep = \&Coro::AnyEvent::sleep; } my @q = map { async { prepare_requests() } } 1 .. $count; @q = map { $_->join } @q; @q = map { async { submit_form(@_) } $_ } @q; $_->join for @q;