You can have a iw_perl tag before the iw_iterate tag for i=0 (say) and have another iw_perl tag in the iw_iterate tags which does the increment i++. By this, you can capture the value of i and you can use it whereever you want.I had added the suggested code at the end of the attached file.