This is weird. If you are removing duplicates the idiomatic way to do it is:

```perl
my @uniquehosts = keys(map {($_ => 1)} @allhosts);
```