$i == 1rather than
$i = 1. The former tests if
$iis 1 or not, and the latter assigns the value 1 to
$i(and returns the value 1, so is always considered true, so the loop will stop).
But if you use the loop I suggested, that replaces the do loop anyway.