in reply to Modification of a read-only
The code @$x = map { $_ ||= "" } @$x; modifies the original values of @$x and the replaces @$x with those modified values. It is a bit redundant, like doing:
Two good heuristics when using map: and you've broken rule 2 here.for( @$x ) { $_ ||= ""; } @$x= @$x;
This code @$x= map { defined($_) ? $_ : "" } @$x; avoids that problem.
- tye (but my friends call me "Tye")
|
|---|