in reply to strange character with HTTP::Request GET

Generally chop should be avoided and chomp used instead.

ord is a better way to "see" strange characters:

open(FH,'orders.csv') or die "$!"; while($line = <FH>) { my $character = chop($line); print ord ($character), "\n"; }

Most likely you have fallen foul of network / local OS line end differences or code that doesn't appreciate such differences. The new line character is being treated as a line end character where really there is a cr/lf pair and the cr (carriage return) is being passed back as the last character on the line.


Perl is environmentally friendly - it saves trees

Replies are listed 'Best First'.
Re^2: strange character with HTTP::Request GET
by sam313 (Initiate) on May 01, 2008 at 04:59 UTC
    I'm sorry, this is as simple as using chomp instead of chop isn't it? Sorry for being brain dead tonight and thank you for your help!
      $\ is set to LF, even on Windows, so you'd need to change it to "\x0D\x0A" for chomp to work here.
Re^2: strange character with HTTP::Request GET
by sam313 (Initiate) on May 01, 2008 at 04:55 UTC
    It would seem you are right. Thanks!! Is there a simple way to drop the CR?