On Wed, 30 Aug 2000 16:14:35 -0600, Tom Christiansen wrote:
>>I say we drop chop().
>
>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'm not sure I find either of those more legible.
I'm sure. It's not. But either of this works.
substr($_, -1) = '';
$chopped = substr $_, -1, 1, '';
chop() is a speed optimization for a (currently) pretty uncommon task:
removing the last character of a string. Why not the first character,
for example? The string equivalent of shift()?
Only people who insist that ALL lines in a text file should end in a
newline, would still prefer use it.
--
Bart.
- 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
- Re: Proposal: chop() dropped Nathan Torkington
