Re: RFC: utils.pm

From: Joe Smith (Joe.Smith_at_inwap.com)
Date: 02/12/04


Date: Thu, 12 Feb 2004 07:51:06 GMT

Ben Morrow wrote:

> Tore Aursand <tore@aursand.no> wrote:
>> trim( $value ) - Combines ltrim() and rtrim().
>
> $value =~ s/^\s*(.*?)\s*$/$1/;
> or some such.

I've always heard that two anchored single-wildcard searchs are
faster than a single regex with three wildcards.

   $value =~ s/^\s+//; $value =~ s/\s+$//;

        -Joe