in reply to The behavior of array and hash OPs
When you set/get a scalar from an array/hash, its value is copied:Not always:
use strict; use warnings; use 5.010; my @arr = (1, 2, 3); for (@arr) { $_ *= 2; } print "@arr\n"; --output:-- 2 4 6
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: The behavior of array and hash OPs
by ikegami (Patriarch) on Jun 22, 2011 at 04:05 UTC | |
|
Re^2: The behavior of array and hash OPs
by 7stud (Deacon) on Jun 22, 2011 at 06:01 UTC | |
by frieduck (Hermit) on Jun 22, 2011 at 16:05 UTC | |
| |
|
Re^2: The behavior of array and hash OPs
by llancet (Friar) on Jun 23, 2011 at 08:35 UTC |