sub checkMAC { my $mac = shift; my $httpThr = async { return head "http://$mac:80"; ## Simplified!! }; my $authResult = get 'http://AuthServer/Check.pl?$mac'; ## Simplified!! my $httpReult = httpThr->join; ## join immediately lock %macs; $macs{ $mac } = $httpResult && $authResult ? 1 : 0; } #### while( ) { next unless m[ ACK \s+ ( (?: [0-9a-f]{2} : ){5} : [0-9a-f]{2} )]xi; async( \&checkMAB, $1 )->detach; ## detach cos there's no result we're interested in }