my %index = map { $_->key => $_ } @objects; #### my %index = map (($_->key => $_), @objects);