in reply to Chomp(<handle>)
My best guess as to the reasoning is that chomp was designed to also work as chomp( @array ); and it was more efficient to do this 'in-place', rather than returning the list which would have required copying the whole array.
I'm not adverse to efficient constructs, but given that in almost every scenario that I can think of, whenever I chomp a scalar, I then need to pass that scalar onto something else, I wish that when chomp was called with a single scalar argument in a scalar context, it would edit the argument in-place and then return an alias to the argument that could be used as an rvalue.
Its probably too late to change it as I'm sure that there are some circumstances in which this would break existing code. Though, off the top of my head, I can't think of any, but someone will show me the shallowness of my thoughts:)
|
|---|