in reply to a farewell to chop
I can well understand them getting rid of chop, although I do think the main problem is having it named so similarly to chomp.
When I was beginning Perl I came across chop and chomp, and whilst I could remember the fact that one wasn't fussy what it removed and one only removed end-of-line characters it took me a remarkable amount of time to learn which was which. Caused some nasty bugs, too.
Since I learnt the names properly I don't think I've ever touched chop for anything. So far you've only said you've been able to find one example, and people can do it with substr's (substr ($foo,-1) = '', admittedly messy), or a simple regexp $foo =~ s/.$//; which to me is perfectly readable. I really don't see the advantage of keeping chop paying off against the risk of having the confusing (and easily mis-typed) chomp/chop pair.
I also can't see many people are going to go and write their own version of chop, to be honest. It's a simple enough thing to 'just do' and the function call imposes a much higher overhead than the operation itself.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: a farewell to chop
by particle (Vicar) on Sep 11, 2002 at 15:50 UTC | |
by tommyw (Hermit) on Sep 11, 2002 at 15:56 UTC | |
by particle (Vicar) on Sep 11, 2002 at 18:29 UTC | |
by John M. Dlugosz (Monsignor) on Sep 11, 2002 at 16:06 UTC | |
by particle (Vicar) on Sep 11, 2002 at 17:41 UTC | |
by Juerd (Abbot) on Sep 11, 2002 at 22:48 UTC |