if (my (@captures) = $expr =~ /regex/) { # do something with @captures } else { # did not match }