I think my question can be best understood by example -- what
does the following produce?

    my @a = 1,2,3,4,5;
    for @a { .say; @a = (); }

My question is whether the change to @a inside the for loop
affects the iterator created at the beginning of the for loop.
In other words, would the above produce "1\n2\n3\n4\n5\n"  or
"1\n" ?

My followup question is then:

    my @a = 1,2,3,4,5;
    my @b = 6,7,8;

    for @a,@b { .say; @b = (); }

I have more examples involving various aspects of list and
iterator semantics, but the answers to the above will help guide
my questions.


Reply via email to