>>>>> "Fei" == Fei Li <[EMAIL PROTECTED]> writes:
Fei> foreach (@test){ Fei> my $n= shift (@test); The foreach loop walks over the array "live". If you modify the array inside the loop, the results are definite, but often unexpected. Maybe you want instead: while (@test) { # do until @test is empty my $n = shift @test; ... } -- Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095 <[EMAIL PROTECTED]> <URL:http://www.stonehenge.com/merlyn/> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc. See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training! -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>