In each case, the variable, $sub, is aliased to what's in the parens on the foreach line. In the second case, that's a read-only value, not a variable. For more, have a look at Common Causes for "Modification of a read-only value attempted".
In reply to Re: Modification of a read-only value attempted
by kyle
in thread Modification of a read-only value attempted
by ropey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |