Hi, I got a very strange problem about for and foreach. I don't understand why.
The following is my program: === #!/usr/bin/perl use strict; my @array = (1, 2, 3); print @array; foreach (@array) { print $array[0]; print $array[1]; print $array[2]; open FILE, "<bbb"; while (<FILE>) { print "hello\n"; } close FILE; } print @array; print $array[1]; === "bbb" just a file contains only one line like "kdfjkdfjlsjfslkf". My question is, why @array are changed after this foreach loop!!! If I change it to for loop, then everything is fine. Really don't understand. Thanks. Yours, Yan -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/