On Wed, Jun 24, 2009 at 03:02:00AM +0200, Gunnar Hjalmarsson wrote: > Roman Makurin wrote: >> >> use constant { >> A => 1, >> B => 2, >> C => 3 }; >> >> @a = (1, 2, 3); >> @b = (A, B, C); >> >> # first loop >> while(my $i = shift @a) { >> print $i, $/ >> } >> >> # second loop >> while(my $i = shift @b) { >> print $i, $/ >> } >> >> My question is why the first loop work as expected, but >> second doesnt. > > My questions are: How did you expect the second loop to work, and what > output did you get? (They both "worked" fine for me.) > > -- > Gunnar Hjalmarsson > Email: http://www.gunnar.cc/cgi-bin/contact.pl > > -- > To unsubscribe, e-mail: beginners-unsubscr...@perl.org > For additional commands, e-mail: beginners-h...@perl.org > http://learn.perl.org/ >
output of first loop: 1 2 3 but there is nothing from the second loop, while I expect that it would be the same. And I dont understand why it happen :) Thanks -- If you think of MS-DOS as mono, and Windows as stereo, then Linux is Dolby Digital and all the music is free... -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/