RE: Referenced data changing

2008-09-08 Thread 田口 浩
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_v

Referenced data changing

2008-09-08 Thread 田口 浩
Hello, I'm just maintain this odd script. On the code; foreach my $val (@{$$code{"1"}}) { I think $val is lexical but in the 2nd call of test_val the data is changed. I don't want it. I must code like; my $val2 = $val; $val2 =~ s/^0+//; to avoid the changing. I cann't understand why? #