use threads; my $thr = async{ &download_a_file(); }; &calculate_network_bandwidth() while($thr->is_running()); $thr->join();