in reply to Re: Smart Substrings
in thread Smart Substrings
This is equivalent, but faster and more readable. Don't use a regex unless you actually need it.my $short = substr $string, 0, 15;
Your second snippet doesn't split on words. You would need to change the \s* to a \s+ for it to do that, but then it would break on a starting word greater than 15 chars.
I don't mean to offer harsh criticism, but one of my pet peeves is seeing regexes used when a simple index/substr would do.
MeowChow s aamecha.s a..a\u$&owag.print
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Smart Substrings
by Pin (Novice) on Apr 03, 2001 at 20:48 UTC |