This also is fixed in Perl 6. You can get at the captures as an array if you like, or you can even bind the variables directly within the pattern and bypass the assignment altogether (though you'd still have to declare the variables in that case). Alternately, you can name the captures within the pattern and then get at them as a hash. With some syntactic sugar, $1
is also called $<this>
is also called $<that>
, etc., and it's just pulling captures
out of the result object without you having to declare anything (except the name bindings within the pattern).
A few other pattern matching things have changed too. :-)