in reply to Re: How to replace in one regexp
in thread How to replace in one regexp

Good call to use URI, but your code does something different than the OP's. The following would be equivalent:
#!/bin/env perl use strict; use warnings; use URI qw( ); my $target = "/index.php?prefix=/user/"; my $path = URI->new_abs( '.', $target )->path(); print "$path\n";