$progress = Term::ProgressBar->new({count => $total_size, ETA => 'linear'}); $progress->max_update_rate(1); my $response = $ua->get($url, ':content_cb' => \&callback, ); $progress->update($total_size); sub callback { my ($data, $response, $protocol) = @_; $final_data .= $data; $next_update = $progress->update(length($final_data))if length($final_data) >= $next_update; }