The above notes are confusing 2 different Perl fuctions, chop and chomp.
In Perl, chop removes and returns the last charecter of a string. This function was often used in Perl <= version 4 to remove newlines, and in some cases, you'd think you were choping a new line, but if the last charecter wan't a newline, chop would still remove it.
As of Perl 5, chomp (note the "m") was introducted. Chomp removes the last character(s) of a string only if those chatecters are new lines, and it returns the number of characters deleted. (If the string ends in multiple newlines, they will all be choped off, and if the last charecter is not a new line, nothing will be choped off.)
So, I don't think either of the above examples quite duplicate Perl's chomp, but they are both very helpful.