Another issue is the evaluation order. I think Perl looks up the lvalue for
$foo{$user} before assigning the new value to
$user, perhaps even before performing the
split! In general, you can't count on order of evaluation so should never use a value more than once in an expression if one of the uses modifies the value.
—John