in reply to Arrary ref stored in hash always points to the same array?

Think of this way: you're setting $cluster{$user} to a reference to the same array every time. Why would you expect a different value?

A simple rewrite that does what you want is to use an anonymous array reference right up front:

while (<>) { chomp; $ref = [ split ]; # new anon.array every iteration $user = shift @$ref; $cluster{$user} = $ref; }
Some cleanup is possible (mainly using strict and tightening up the code a bit), but I wanted to make the line-by-line correspondence to your code clear.

HTH

Update
Took out a confusing sentence....