|There's more than one way to do things|
actually chomp() returns the number of "characters" that were chomped - not the delimiters.
You're right of course. (But your over elaborate demonstration added nothing to the simple statement of fact.)
I remember discovering early on that the return from chomp wasn't useful and I've never concerned myself with what non-useful thing it actually returned ever since.
So the OP's code is not going to work...
That was the point I was making when I said: "Neither snippet will do what you think it will do.".
With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.