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
In reply to Re: resetting Perl RegEx backreferences
by hv
in thread resetting Perl RegEx backreferences
by samizdat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |