On Wed Jun 02 14:50:54 2010, [email protected] wrote:
> Creating several regexes should return several different objects:
>
> say /@_[0]/, /@_[1]/, /@_[2]/ given <A B C>
> _block27 _block35 _block43
>
>
> However, inside a loop, instead of different regexes, the final one
> gets repeated:
>
> say /$_/ for <A B C>
> _block32 _block32 _block32
>
You're reading this wrong. A regex is like a sub, so your final example
is saying something more like:
say rx { $_ } for <A B C>
The regex itself is created (once) at compile time. It is then
evaluated three times as part of the for loop.
An analogous example would be something like:
say sub { $_ } for <A B C>
Rejecting ticket,
Pm