in reply to How do you chomp your chomps?

chomp is based on chop and chop modifies in place so that it can return the character that was chopped, so it makes some sense to have chomp also modify in place since it just a "safer chop". chomp can also work on a list of items, in which case the return value is more than a Boolean.

Also, shortening a string in place is extremely efficient. To return a modified value would require allocating another buffer and copying nearly the entire string.

There are several operations that modify in place: s///, tr///, read(), sysread(), etc. For most of them, I've run into cases where I'd rather have them return the modified value so I do see your point. But the inconvenience is fairly minor -- we just get used to not having to up with even minor inconvenience because we are using Perl. (:

Also, if it only returned the modified value (and didn't also modify in place), then you'd constantly be writing $input_line= chomp($input_line) and requiring the repetition isn't good. If it modified in place and returned the modified value, then there'd be no good way to tell if a modification took place.

So it's a mixed bag. :-}

        - tye (but my friends call me "Tye")