in reply to Re: RFC - FAQ for Modification of a read-only value attempted
in thread RFC - FAQ for Modification of a read-only value attempted

The difference between a list and an array is often ignored...
Indeed; for never iterates over an array. for always iterates over a list.

What do either of those mean? Based on later replies, it seems like people are interpretting it in terms of whether or not $_ is an alias or a copy. But saying "$_ is an alias" or "$_ is a copy" actually means something clear.

Is there some other meaning? For example, when foreach is given an array, it might make a new list of aliases to each array member and then iterate over that list, and thus not ever directly iterating through the array. Now that I think of that, it fits what you wrote quite well, but doesn't match how others interpretted it. I guess this behavior matters if you modify the array (adding or removing members) while you are in the loop and I suspect that is what foreach does.

Is that all that you meant or are there other aspects?

imp, what did you mean?

- tye        

  • Comment on Re^2: RFC - FAQ for Modification of a read-only value attempted ("list"??)

Replies are listed 'Best First'.
Re^3: RFC - FAQ for Modification of a read-only value attempted ("list"??)
by imp (Priest) on Aug 29, 2006 at 14:38 UTC
    In the first draft of this document I discussed list versus array, but decided to trim it down before posting since it was outside of my intended scope.

    In that version I referenced a post by you that provided what I thought was a nice explanation:
    Re: Differ. array and List (there is no List)