in reply to Re^2: use array for hash-keys without loop
in thread use array for hash-keys without loop

Yes, there's a lot of different ways of writing loops.

Note that your code can be simplified to

my %y; $y{shift(@x)} = 1 while @x;
or the non-destructive
my %y = map { $_ => 1 } @x;