$condvar->begin; say "Active ${aval}, Offset ${oval}"; ### This was originally another sub, but I brought it inline for debug my $content; my $fh = FileHandle->new; if ($debug) { say "Reading ${localfile} offset ${offset} for length ${contentLength}";} $fh->open("< $localfile"); binmode($fh); read($fh,$content,$contentLength,$offset); if ($debug) { say "readData read ".byteSize($content);} $fh->close; ### http_request "PUT" => $url, headers=>$headerVals, body=>$content, sub { my ($body, $hdr) = @_; say "received, Size: ", length $body; say $body; $activeCount--; $condvar->end; doProcess(); }; return 1