I read this earlier and for some reason, I haven't been able to shake it out of my head all day. I've finally settled on why. I would rather see chomp go.
It seems to me that chop is the more general function in that it'll remove any character. Furthermore, it has a more useful return value. Lastly, chomp could easily be replaced with a nice simple regex s|$/$||; which, in scalar context, would return a value about as useful as chomp's.
Don't get me wrong. I understand the benefits of chomp (for cross platform code in particular) and I know chomp is ubiquitous in existing code. I don't really think chomp should be removed either.
It's just that, of the two, I like chop more. It's an old friend that I still fondly remember from the perl4 days before chomp.
If the standalone chop has to go, I like John's idea of making it a method in the string class. That said, I strongly agree that chop should be kept. I don't think it should be renamed. Without it, Perl will feel just a little less like Perl to me.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: a farewell to chop
by sauoq
in thread a farewell to chop
by John M. Dlugosz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |