I am very new to HTTP inside Perl. I have written a script to download a CSV file from my shopping cart website using an HTTP::Request GET. Everything works fine but there is a strange character at the end of each line that I cannot identify. I cannot just use chop on each line because it does not show up on every line. Here is my code, maybe someone can help me understand what this character is or how I can get rid of it.
$h = new HTTP::Headers Content_Base => '$url'; $h->authorization_basic($uname, $password); $request = HTTP::Request->new( 'GET', $url, $h ) ; $ua = LWP::UserAgent->new; $count = 0; $response = $ua->request($request); while (!$response->is_success) { writelog("Failed to GET '$url': ".$response->status_line); sleep(30); $count++; $count < 20 or die "Failed to GET '$url': ", $response->status_line; $response = $ua->request($request); } open (FH, '>orders.csv'); print FH $response->decoded_content; close FH;
I tried to identify the strange character with the following debug code:
open(FH,'orders.csv') or die "$!"; while($line = <FH>) { $character = chop($line); print "!!!! $character ****\n"; }
The output from the above debug code was:
****
****
What kind of character would cause the bangs to not be displayed?

In reply to strange character with HTTP::Request GET by sam313

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.