# $buf has the reponse read directly off the socket # the first line should be the status line my $response_ok = $buf =~ /^(HTTP[^\r\n]+)\r?\n/i; my $status_line = $1; if (not $response_ok) { # yikes, response has no status line!? (bail out) } my ($protocol, $status, $msg) = split ' ', $status_line; if ($status == 200) { # success, got 200 (OK) response } else { # error, not OK response }