Please look at the end of the important Perl code note. With Ruby you can do
u, v = a.match(/(.*?):(.*?)@/)[1,2]
String # match. recongizes /.../ , Regexp, Regexp match . MatchData, . 0 , 1,2....
, nil, , if u.nil? NilClass.
if matched = a.match(/(.*?):(.*?)@/)
u, v = matched.captures
end
MatchData # capture. $1 $2 .
, , , .
Ruby.
u, v = (/(.*?):(.*?)@/).match(a)[1,2]
/.../ Regexp, match .
, String # split
u, v = a.split(/:|@/)[0..1]
a :, @ .
Perl , .
, . my $x = 1 - , - . , , .
, ... ?
Statement perlsyn ( )
.. my, state our, (, my $x if ...), undefined. my undef, , , - . . perl - perl, . .
, Perl. , regex
my ($u, $p) = $a =~ /(.*?):(.*?)@/;
$u $p. , .