Erik Price wrote:

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


I still like my Iterate module.
you get access to the value 
(which used to be in $_)
and the current index into the array.

 use Iterate;

 IterArray @array, sub 
        {
         print "index=".($_[1])." value=".($_[0])."\n";
        };
 
It keeps its Perlish roots, looking most like a
foreach loop, and allows direct access to index/values.

Course, I'm likely biased because I wrote it.

Oh well, the thing about perl better than all
of this is that there's always more than one
way to do it.

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

Reply via email to