use LWP::UserAgent; $ua = LWP::UserAgent->new; #$URL = 'http://whatever/file.html'; my $expected_length; my $bytes_received = 0; my $req = HTTP::Request->new( GET => $URL ); my $res = $ua->simple_request($req, sub { my($chunk, $res) = @_; $bytes_received += length($chunk); unless (defined $expected_length) { $expected_length = $res->content_length || 0; } if ($expected_length) { printf STDERR "%d%% - ", 100 * $bytes_received / $expected_length; } print STDERR "$bytes_received bytes received\n"; }); print $res->status_line, "\n";