On Sat May 25 21:13:26 2013, coke wrote:
> 23:54 < [Coke]> r: for 1..10  { my $a = 3; FIRST { say $a} }
> 23:54 <+camelia> rakudo 45ae2d: OUTPUT«(Any)␤»
> 
> I would expect that to output "3".
> 

Since the FIRST block is invoked before the assignment/initialization, 
the output of "Any" seems correct.

For example:

    > for 1..5 { my $a; FIRST { $a = 3 }; say $a }
    3
    (Any)
    (Any)
    (Any)
    (Any)
    > 

Thus the FIRST block sees the correct lexical $a... it's just executing 
before the initialization.

Pm

Reply via email to