in reply to hash assignment in complex structure

Hm. I don't know enough about slices to know if it's possible like that -- Seems like loop might be the way to go (and maybe clearer anyways. Here's a slightly different loop syntax (also, this is non-destructive):
$hash{$type}->{ $sorted_keys[$_] }->{data} = $mydata[$_] for 0 .. $#so +rted_keys;