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

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.)