void myxsub(...) PREINIT: int i; CODE: for(i=0; i< items; i++){ SV * sv = ST(i); //do something }