| |||||||||||
| |||||||||||
foreach.. Posted by kitwalker2886 (kitwalker2886), 9 June 2007 this is a doubt i came up with when i was tryin to pop out the entire contents of an array..foreach(@conseq) { pop @conseq; } this code dint work properly.. i was still gettin some elements in the array.. But.. foeach(0..scalar(@conseq)) { pop(@conseq); } This code cleared out the entire array.. Any explanation why this is so..?? Posted by admin (Graham Ellis), 9 June 2007 Yes, it's because the first piece of code sets up a temporary list for perl to traverse and doesn't keep going back to the original each time. Whther or not it behaves in this way doesn't matter in the second case as you're using a count.This page is a thread posted to the opentalk forum
at www.opentalk.org.uk and
archived here for reference. To jump to the archive index please
follow this link.
|
| ||||||||||
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: info@wellho.net • WEB: http://www.wellho.net • SKYPE: wellho |