From: josh.cheek@... Date: 2016-11-12T20:30:21+00:00 Subject: [ruby-core:78099] [Ruby trunk Feature#12926] -l flag for line end processing should use chomp! instead of chop! Issue #12926 has been reported by Josh Cheek. ---------------------------------------- Feature #12926: -l flag for line end processing should use chomp! instead of chop! https://bugs.ruby-lang.org/issues/12926 * Author: Josh Cheek * Status: Open * Priority: Normal * Assignee: ---------------------------------------- Using `chop!` can mess up the final line of input because it may not end in a line-end character. ``` printf a\\nb\\nc | ruby -lne 'p $_' "a" "b" "" $ printf a\\nb\\nc\\n | ruby -lne 'p $_' "a" "b" "c" ``` Using `chomp!` works correctly in both cases. ``` $ printf a\\nb\\nc | ruby -ne '$_.chomp!; p $_' "a" "b" "c" $ printf a\\nb\\nc\\n | ruby -ne '$_.chomp!; p $_' "a" "b" "c" ``` -- https://bugs.ruby-lang.org/ Unsubscribe: