develooper Front page | perl.perl5.porters | Postings from July 2020

Re: Request review for adding a text trim() function to core

Thread Previous | Thread Next
Eric Brine
July 21, 2020 18:35
Re: Request review for adding a text trim() function to core
Message ID:
Having a function to trim both ends but not one to trim trailing whitespace
is really weird to me. Virtually every program I write needs the latter
(though I usually settle for chomp).

On Tue, Jul 21, 2020 at 1:59 PM Scott Baker <> wrote:

> It's been a personal pet peeve of mine that Perl has never had a *trim()*
> function in core. After discussion
> <> with Grinnz, Leonerd, and
> others we decided to move forward with seeing what it would take to add it
> to core. I wrote documentation and tests, and LeoNerd wrote the actual
> implementation. Now I'm here soliciting feedback on this feature before I
> submit a formal PR.
> You can checkout my branch here:
> Once it's built the easier way to test it is: ./perl -Ilib -E 'say
> CORE::trim("   Hello world!    ");'
> You will get an experimental warning, but the function should work and
> remove the whitespace.
> - Scottchiefbaker

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About