in reply to Still don't undersand "Modification of a read-only value attempted" error
OK, I understand the difference between a variable and a constant. But my problem is that I can't grasp exactly when Perl decides which one it is. My thoughts are..."abcdef" is a constant of type string. It looks like in both cases, it is eventually assigned to $item. If it is assigned to a element of @list first, then assigned to $item in the foreach statement, it still seems that $item contains a string. It seems like in the end, $item contains the same thing. Now does this have somehting to do with $_ and is the error msg really refering to $_ as the Read Only constant?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Still don't undersand "Modification of a read-only value attempted" error
by Eliya (Vicar) on Jun 20, 2012 at 22:39 UTC | |
by Dan.Pinvidic (Initiate) on Jun 20, 2012 at 22:46 UTC | |
Re^2: Still don't undersand "Modification of a read-only value attempted" error
by gg48gg (Sexton) on Jun 21, 2012 at 04:18 UTC | |
Re^2: Still don't undersand "Modification of a read-only value attempted" error
by gg48gg (Sexton) on Jun 21, 2012 at 04:15 UTC |
In Section
Seekers of Perl Wisdom