in reply to Re: complicated expression
in thread complicated expression

A clever solution!

If things get out of order, though, things could get messy. A parameter could be missing too. Slower, but more thoroughly:
my @parts = split (' ', $str); my ($ip, $path) = @parts[0,1]; my ($user, $pass, $port) = @{{map {split(/:/)} @parts[2,3,4]}}{'l','p' +,'port'};
This creates an anonymous hash with entries according to your 'x:y' specification, though no checking is made for 'x:y:z', which is presumably invalid and liable to break this badly. Assuming that's alright, then what happens is the 'l', 'p' and 'port' values are extracted, in that specific order. If one is not specified, it comes out as undef.