use AnyEvent; use AnyEvent::HTTP; my $done = AnyEvent->condvar; # stores whether a condition was flagged http_get "http://www.google.com/", sub { print $_[1]; $done->send }; $done->recv; # enters "main loop" till $condvar gets ->send