for($i=0;$i<@array;$i++) { if(&should_delete($i)) { splice @array,$i,1; $i--; } }