my $url = "/bla/bla/123;yarg"; $url = (split "/", (split ";", $url)[0])[-1]; print $url;