On Tue, May 10, 2011 at 1:32 PM, Leo Susanto <leosusa...@gmail.com> wrote:
> http://en.wikipedia.org/wiki/Trim_%28programming%29
>
> $string =~ s/^\s+|\s+$//g ;     # remove both leading and trailing whitespace
>

1. don't do that. search on perlmonks and you'll find a long
discussion with benchmarks. that takes quite a bit longer and isn't
much more typing than separating them out.

though, i don't know whether putting the regex in an array and doing
$string ~~ @reg might be as slow as that.

2. don't top post - i cut out the rest of the conversation because i
had no other way to respond inline.

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to