Hi All,

I adore this feature of loops:

perl6 -e 'my @x=qw[a b z y];
   for @x -> $a, $b { say "<$a> <$b>" };'

<a> <b>
<z> <y>


because I can preassign a names to "$_".

Question:  in a pattern match such as:

perl6 -e 'my $x="ab12cd";
   $x ~~ m/(ab)(12)(cd)/;
   say "$x\n\$0=<$0>\t\$1=<$1>\t\$2=<$2>\n";'

ab12cd
$0=<ab>   $1=<12>   $2=<cd>

Is there a similar way to preassign names to
"$0", "$1", "$2" ?


Many thanks,
-T


--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Computers are like air conditioners.
They malfunction when you open windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Reply via email to