Tom Christiansen writes:
> So code that says
>
> chop($k,$v)
>
> will need to say
>
> for ($k,$v) { s/.\z//s }
>
> or else something like:
>
> for ($k, $v) { substr($_, length() - 1) = '' }
I don't think chop() is an operation that's done often enough for
either of the things above to be a problem.
> I'm not sure I find either of those more legible. And they certainly
> won't be faster. chop() has been around since perl1, too.
Yes, but chop()'s original purpose was what chomp() is now used for.
I doubt Larry would really have put in a function to remove the last
char in a string just to have a function that removes the last char in
a string. It was the chomp()-like itch I think he was trying to
scratch.
> Then again, yes, people do tend to use it when they oughtn't. Hm...
Exactly.
Nat
- Proposal: chop() dropped Nathan Torkington
- Re: Proposal: chop() dropped Jonathan Scott Duff
- Re: Proposal: chop() dropped Tom Christiansen
- RE: Proposal: chop() dropped Al
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Nathan Wiger
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Nathan Torkington
- Re: Proposal: chop() dropped Bart Lateur
- Re: Proposal: chop() dropped skud
- Re: Proposal: chop() dropped Ed Mills
- Re: Proposal: chop() dropped Nathan Torkington
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Peter Scott
- Re: Proposal: chop() dropped Tom Christiansen
- Re: Proposal: chop() dropped Jonathan Scott Duff
- RE: Proposal: chop() dropped Eric Roode
- Re: Proposal: chop() dropped Eric Roode
