On Sunday, December 8, 2002, at 11:56  PM, Komtanoo Pinpimai wrote:

you see? It is not elegant.. has perl this iterator variable ?
Man! And I thought one of the nice things about Perl was you didn't have to use an Iterator to traverse a List!

Iterator it = myList.iterator();
while (it.hasNext()) {
MyObject mo = (MyObject)it.next();
// do something with mo
}

(In all honesty, I really do think [Java/Python-style] iterators are cool, for situations that need them. But it's admittedly more work than using a counter variable, so when you want to bang out some quick Perl, it's nice not to have to bother with it.)



Erik





--
Erik Price (zombies roam)

email: [EMAIL PROTECTED]
jabber: [EMAIL PROTECTED]

_______________________________________________
Boston-pm mailing list
[EMAIL PROTECTED]
http://mail.pm.org/mailman/listinfo/boston-pm


Reply via email to