appleii has asked for the wisdom of the Perl Monks concerning the following question:
#!/bin/env perl use strict; use warnings; my $target = "/index.php?prefix=/user/"; my $path = $target; # How to optimize? $path =~ s{\?.*$}{}; $path =~ s{[^/]+$}{}; print "$path\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to replace in one regexp
by Sue D. Nymme (Monk) on Sep 30, 2009 at 17:37 UTC | |
|
Re: How to replace in one regexp
by Anonymous Monk on Sep 30, 2009 at 15:27 UTC | |
by ikegami (Patriarch) on Sep 30, 2009 at 18:33 UTC | |
|
Re: How to replace in one regexp
by appleii (Novice) on Sep 30, 2009 at 16:51 UTC | |
|
Re: How to replace in one regexp
by JavaFan (Canon) on Sep 30, 2009 at 16:18 UTC | |
|
Re: How to replace in one regexp
by vitoco (Hermit) on Sep 30, 2009 at 16:27 UTC | |
|
Re: How to replace in one regexp
by vitoco (Hermit) on Oct 01, 2009 at 21:46 UTC |