Oops! I misunderstood what the OP wanted. My answer below works for Incoming headers not Outgoing*

The following works:

use warnings; use strict; use LWP::UserAgent; my $ua = LWP::UserAgent->new; my $url = 'http://www.google.com'; print $ua->head($url)->as_string;
OUTPUT:
HTTP/1.1 200 OK Cache-Control: private, max-age=0 Connection: close Date: Sat, 24 May 2014 04:17:59 GMT Server: gws Content-Type: text/html; charset=ISO-8859-1 Expires: -1 Alternate-Protocol: 80:quic Client-Date: Sat, 24 May 2014 04:16:04 GMT Client-Peer: 174.194.08.94:80 Client-Response-Num: 1 P3P: CP="This is not a P3P policy! See http://www.google.com/support/a +ccounts/bin/answer.py?hl=en&answer=151657 for more info." Set-Cookie: PREF=ID=6be73c938c0eb2c2:FF=0:TM=1400905079:LM=1400905079: +S=d_WzZRSOQ6IZBvFA; expires=Mon, 23-May-2016 04:17:59 GMT; path=/; do +main=.google.com.ng Set-Cookie: NID=67=bU9SctXcLKJvZuBUQclTeWSIIJPWwD579z8_VsFNdP9AtU2dVx_ +5_rpEj_AGQIvcXVqeV3xka5H9aGSX_SN62h-bQ70smhmQ77HRB3o0uTsdUFnNeNU0u--x +2IYvBj8c; expires=Sun, 23-Nov-2014 04:17:59 GMT; path=/; domain=.goog +le.com.ng; HttpOnly X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block

* Update

If you tell me, I'll forget.
If you show me, I'll remember.
if you involve me, I'll understand.
--- Author unknown to me

In reply to Re: LWP is there any way to get "real" outgoing headers? by 2teez
in thread LWP is there any way to get "real" outgoing headers? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.