Re: Simplest Way
- From: usenet@xxxxxxxxxxxxxxx
- Date: 19 Jan 2006 14:13:00 -0800
Paul Lalli wrote:
>http://perldoc.perl.org/perlfaq4.html#How-do-I-strip-blank-space-from-the-beginning/end-of-a-string%3F
The perldocs are correct and fine, of course, but if you want to do it
the "Damian Conway way" (from his book, Perl Best Practices) you would
use a syntax something like:
s{\A \s* | \s* \z}{}gxm;
Or maybe
use Regexp::Common qw /whitespace/;
s/$RE{ws}{crop}//;
Damian makes a good case for these techniques... it would be wise for
coders to consider his recommendations, even though (in this sort of
situation, at least) they are a rather severe departure from
long-established practices.
New coders should especially consider Damian's recommendations, so they
don't need to struggle with un-learning old (and not so good) habits.
.
- Follow-Ups:
- Re: Simplest Way
- From: abhi
- Re: Simplest Way
- References:
- Simplest Way
- From: Gladstone Daniel - dglads
- Re: Simplest Way
- From: Paul Lalli
- Simplest Way
- Prev by Date: Re: Nested Loop
- Next by Date: Re: Nested Loop
- Previous by thread: Re: Simplest Way
- Next by thread: Re: Simplest Way
- Index(es):
Relevant Pages
|