If you feel the urge to use an iterator in PDL, quite often that is a sign you could instead use "array programming" type constructs (see https://en.wikipedia.org/wiki/Array_programming), which lets all the processing be done inside the fast C loops, rather than going backwards and forwards between Perl and PDL.