[oak perl] Simple Question re Zapping Blanks

Kester Allen kester at gmail.com
Wed Nov 9 14:22:04 PST 2005


My favorite is:

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

(substitute one or more leading whitespace chars OR one or more
trailing chars with
nothing).

--Kester

On 11/9/05, Eugene <eugene at metaart.org> wrote:
> In Perl,
> what's the best way (or a good way, anyway)
> to zap leading and trailing blanks in a string?
>
> _______________________________________________
> Oakland mailing list
> Oakland at pm.org
> http://mail.pm.org/mailman/listinfo/oakland
>


More information about the Oakland mailing list