Just another Perl shrine | |
PerlMonks |
Different result for 'foreach' vs 'while shift' arrayrefby gvandeweyer (Initiate) |
on Apr 18, 2014 at 08:52 UTC ( [id://1082731]=perlquestion: print w/replies, xml ) | Need Help?? |
gvandeweyer has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I having problems understand why the following two snippets give different result (the second one being correct): Situation: Arrayref with database rows, returned from subroutine, in my test-case 927306 rows:
Snippet one: Using while shift to return rows yields only 788425 resulting rows
Snippet two : Using foreach returns all rows:
I thought that these should be equivalent? Best, Geert
Back to
Seekers of Perl Wisdom
|
|