in reply to resetting Perl RegEx backreferences

As davido says, checking that the match succeeded is almost always the right solution. If for some reason you don't want to do that, easiest way is to throw a cheap guaranteed match in before the real match:

"" =~ /(?=)/; # reset match vars $dorient =~ /^([^_]+)_/; $rs[2] = $1; # or undef if no match

Hugo