#! perl -sw use 5.010; use strict; use threads ( stack_size => 4096 ); while( 1 ) { async( \&get_data_and_go )->detach; sleep 5; ## Go get every 5 seconds } sub get_data_and_go { my $tid = threads->tid; require LWP::Simple; ## Requiring prevent CLONE leaks. ##does some webpage stuff and exits my $bytes= length( LWP::Simple::get( 'http://www.yahoo.com' ) ); say "$tid : Got $bytes"; sleep rand 10; ## Simulated variable processing time say "$tid : done"; return 0; };