develooper Front page | perl.perl5.porters | Postings from October 2003

Re: new slurp module

Thread Previous | Thread Next
From:
Steve Hay
Date:
October 24, 2003 09:08
Subject:
Re: new slurp module
Message ID:
3F994EC7.4040701@uk.radan.com
Abigail wrote:

>If we add File::Slurp
>to the distribution, we should also add String::ChopChop which replaces
>the two-line idiom
>
>    $str =~ s/^\s+//;
>    $str =~ s/\s+$//;
>
>with the two-liner:
>
>    use String::ChopChop;
>    chopchop ($str);
>
>After all, it's a common operation, but often done in ugly or inefficient
>ways.
>
What's wrong with the one-liner

    $str =~ s/^\s+|\s+$//g;

:)


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About