Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: How to make only two of three substitutions?

by bigj (Monk)
on Oct 15, 2002 at 15:18 UTC ( #205397=note: print w/replies, xml ) Need Help??


in reply to How to make only two of three substitutions?

Another way, expressing the logic, that the first / mustn't removed, but all others is to say it explizitly.
Assuming the sql statement is one line $sql:
1 while $sql =~ s%(/.*)/%$1%gs;
or with the futuring keep syntax:
use Regexp::Keep; # I believe, it will be unnecessary on Perl 5.10 1 while $sql =~ s%/.*\K/%%gs;

Greetings,
Janek

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://205397]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (12)
As of 2019-10-17 13:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?