http://qs321.pair.com?node_id=633455

spx2 has asked for the wisdom of the Perl Monks concerning the following question:

ok,ive figgured i could make a loop that would feed itself more and more values in the array that it processes. for that matter i've tried foreach and also map. only in one situation of these four that are listed below, i was succesful,in the one that used foreach and push. why don't the other methods work ? how do you explain their behaviour? P.S.:this is not a test.i am just not at all able to understand why perl behaves this way.

=begin BlockComment # BlockCommentNo_1 my @array = ('a'); foreach (@array) { #push @array,'a';#replace following statement with this one @array = (@array,'a'); print; } =end BlockComment # BlockCommentNo_1 =cut my @array=('a','a'); map { #push @array,'a'; #replace following statement with this one @array=(@array,'a'); print; }(@array);