Comment 8 for bug 2015234

Revision history for this message
Andrew Johnson (anj) wrote :

> I'm puzzled why "chomp" doesn't remove both newlines.

Because Perl's $INPUT_RECORD_SEPARATOR = $/ defaults to a newline (line mode). "perldoc perlvar" and search for INPUT_RECORD_SEPARATOR to learn all about it.

Setting $/ to '' should be okay, but I would probably localize it like this (or at least don't do it before the chomp) in case changing it globally has any negative effects on input parsing elsewhere in the code:

{
  local $/; # Temporarily set to ''
  chomp $cv; # Remove all newlines
}