in reply to strange character with HTTP::Request GET

A CR could move the cursor to the start of the line. Why don't you redirect the output to a file and use a hex dumper (od on unix) to id the char?

Replies are listed 'Best First'.
Re^2: strange character with HTTP::Request GET
by sam313 (Initiate) on May 01, 2008 at 04:53 UTC
    Thanks for the suggestion! I did a hex dump and found "0D 0D 0A" at the end of each line or like you said, "CR CR LF". I am not 100% sure how to do it off the top of my head, but I guess I can drop these extra characters.

      It's probably only CR LF. The LF was converted to CR LF by Perl since you didn't binmode(STDOUT).

      You could do:

      while (<$fh>) { s/\x0D\x0A\z//; ... }

      Or change $/:

      local $/ = "\x0D\x0A"; while (<$fh>) { chomp; ... }

      Or if you don't care about whitespace at the end of the line, the following works with CR CR LF and CR LF:

      while (<$fh>) { s/\s+$//; ... }