in reply to partial results in $1 $2 after re failure

Looks like a perl bug to me.... If you flatten out the while() loop:
#!/usr/bin/perl -w use strict; $_ = "abc def\n"; /^(\w+)\s+(\w+)$/; print "<$1><$2>\n"; $_ = "xyz 6-7\n"; /^(\w+)\s+(\w+)$/; print "<$1><$2>\n"; $_ = "123 456\n"; /^(\w+)\s+(\w+)$/; print "<$1><$2>\n";
The output is
<abc><def> <abc><def> <123><456>
Which is what the expected output of your snippet should be. FWIW, replacing the while(<DATA>) with a for(@data) type construct, also producted erroneous results.

Before using $1 et all, you really should check to be sure your match succeeded:

while (<DATA>) { if (/^(\w+)\s+(\w+)$/) { print "<$1><$2>\n"; } else { print "Line $. didn't match\n"; } }

-Blake