if ( ( $target =~ tr/\@// ) < 2 ) { ($user, $passwd, $ipv6, $host, $port) = $target =~ m{^ \s* # space (?: ([^:]+) # username (?::(.*))? # : password \@ # @ )? (?: # host ( # IPv6... \[$IPv6_re(?:\%[^\[\]]*)\] # [IPv6] | # or $IPv6_re # IPv6 ) | # or ([^\[\]\@:]+) # hostname / ipv4 ) (?::([^\@:]+))? # port \s* # space $}ix or croak "bad host/target '$target' specification"; } else { $host = $target; }