in reply to How to remove a carriage return (\r\n)

Chomp removes the line ending native to your platform, because $/ defaults to it. On unix this is simplly a line feed which we often write \n.

If chomp won't do it try:

$key =~ s/\r\n//;

Phil

Update: Explained why chomp usually removes your platform default line ending.

Replies are listed 'Best First'.
Re^2: How to remove a carriage return (\r\n)
by VSarkiss (Monsignor) on Nov 01, 2005 at 16:29 UTC
Re^2: How to remove a carriage return (\r\n)
by tilly (Archbishop) on Nov 01, 2005 at 16:30 UTC
    I prefer  $key =~ s/\r?\n/ so it will handle either style of linefeed, whether your code is running on either Windows or Unix. (On Windows, if binmode is off, you get what look like Unix linefeeds out of Windows linefeeds.)