in reply to Am i formatting correctly?

In the last 2 lines we may assume that
$seen[$i] is equal to "" (the empty string)
That would explain the formating, and indicate a path for a solution.
best regards / allan