in reply to Re^2: Changing array by changing $_?
in thread Changing array by changing $_?
Nope.
will affect the contents of the array just as surely as:foreach my $foo (@bar) { $foo .= 'ack' ; ... } ;
To avoid this you need to:foreach (@bar) { $_ .= 'ack' ; ... } ;
or similar.foreach (@bar) { my $s = $_ . 'ack' ; ... } ;
It's genuine Perl magic. Useful once you know it. A chunk out of your backside when you don't.
|
|---|