If you are iterating over hashes, use `each` instead.

```perl
while (my ($osd, $newosd) = each(%$osds)) {
```

Same for the top-level foreach.