Ohayou. I think what ur asking is why does @code change when u loop over it
with foreach, ne? This is because foreach only takes a reference to the
list values, it doesn't create a copy. So changing the iterand changes the
original value. If u don't want this u have to make ur own copy of the
I have some misunderstanding.
The next code has the same behaviour.
But I was thinking differently...
#!/usr/bin/perl
use strict;
print TEST3 start...\n;
my @code;
push @code, 01;
push @code, 02;
push @code, 03;
for (1..2) { test_val($_) }
sub test_val {
my $p = shift;
print test_val
?? ? wrote:
I have some misunderstanding.
The next code has the same behaviour.
But I was thinking differently...
#!/usr/bin/perl
use strict;
print TEST3 start...\n;
my @code;
push @code, 01;
push @code, 02;
push @code, 03;
for (1..2) { test_val($_) }
sub test_val {
my $p =