my $req = HTTP::Request->new(GET => $good_url); if ($rep_format eq 'HTML') { $req->header('Accept' => 'text/html');} if ($rep_format eq 'PDF') { $req->header('Accept' => 'application/pdf');} if ($rep_format eq 'DELIMITED') { $req->header('Accept' => 'text/plain');} # send request my $res = $ua->request($req); if ($res->is_success) { print "Content-type: ".$res->header('Content-type')."\n\n".$res->content; } else { print "Error: " . $res->status_line . "\n"; }