my $count = 10; my @threads = (); for (1..$count) { my $tid = threads->new(\&RunChild, $_); push (@threads, $tid); } foreach (@threads) { my $num = $_->join(); #Here I want to check return code of thread, so that I can report the error. my $error = ????; if ($error) { print "Thread $num returned error $error\n"; } else { print "Thread $num completed\n"; } } sub RunChild { my $callNum = $_[0]; `curl -o $callNum "http://192.168.1.23/abc.flv"` return $callNum; }