in reply to resetting Perl RegEx backreferences
Alternatively you can assign to your variable directly in list context:
$rs[2] will be undefined, when the match wasn't successful.