|Don't ask to ask, just ask|
Odd behaviour of chomp()by Salvor (Novice)
|on Oct 20, 2015 at 10:46 UTC||Need Help??|
Salvor has asked for the wisdom of the Perl Monks concerning the following question:
in a Perl training (I am the trainer) we discovered some odd(?) behavior of the chomp() function.
I know, of course, that it returns the number of removed line-ends, and so it does:
But to demonstrate wrong usage of chomp(), I tried
What am I missing here? Why doesn't it just overwrite the content of $line with "1"?
I tested it on Linux and Windows/ActivePerl with newer Perls (5.20 I think). Same behaviour.
Perhaps someone could enlighten me/us? Thanks in advance!