Re: hellp improve efficiency
- From: tom@xxxxxxxxxxxxxx (Tom Phoenix)
- Date: Sat, 28 Apr 2007 07:10:00 -0700
On 4/28/07, Jen mlists <practicalperl@xxxxxxxxx> wrote:
}elsif ($uri =~ m|www\.example\.com/v2/|o) {
$uri =~ s|www\.example\.com/v2/|v2.example.com/|;
The /o modifier isn't desirable there. Also, because a s/// will only
replace if the match part succeeds, you can skip the test:
$uri =~ s#www\.example\.com/v2/#v2.example.com/#;
If it matters to you whether the pattern matched or not, you may test
the result in a scalar context:
} elsif ($uri =~ s#www\.example\.com/v2/#v2.example.com/#) {
# substitution succeeded, do nothing further
} elsif (...) {
Hope this helps!
--Tom Phoenix
Stonehenge Perl Training
.
- References:
- hellp improve efficiency
- From: Jen mlists
- hellp improve efficiency
- Prev by Date: Re: Help: Perl Module Installation Issue(s)
- Next by Date: Re: improving my code: array of references
- Previous by thread: hellp improve efficiency
- Next by thread: Re: hellp improve efficiency
- Index(es):