in reply to Still don't undersand "Modification of a read-only value attempted" error
$item is always an alias. In the 'failing' foreach, it's an alias to a constant in a list and hence not modifiable (where would perl save the modification?) For the 'working' foreach, $item is an alias to an array element which is modifiable (since we have some place to save the modification). So either use your array or make a copy of the aliased item:
(my $val = $item) =~ s/abc/zzzzzz/;
-derby
|
---|
In Section
Seekers of Perl Wisdom