Actions
Feature #12926
closed-l flag for line end processing should use chomp! instead of chop!
Description
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"
Actions
Like0
Like0Like0Like0