post-increment (and post-decrement) return a copy of the variables original value.
Thanks, I hadn't appreciated that but it makes perfect sense and explains the second and third cases.
You haven't tested cached lists at all. You never use the same list twice.
In each case I use (1..2). Is it a different list each time?
In the fifth case I was expecting that $_ is an alias to the elements of the list the foreach is iterating over and that that list would be the elements of the list (1..2) rather than the lvalues of the LHS of the list assignment for the reason you gave previously that the elements of the LHS list are immortal. Furthermore, I expected that the values of $_ would be the same as in the first case where $_ should also be aliased to the elements of the list (1..2). Obviously my understanding / expectation is wrong, but I don't know where. The SV instances displayed by Dump() in the first and fifth cases are different and I don't know why.
In reply to Re^5: list assignment and undef
by ig
in thread list assignment and undef
by ig
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |