# Create an ID to name hash my %hash = map { $_->id, $_->name } @Objects; Becomes: # Create an ID to name hash my %hash = map { $_->id => $_->name } @Objects;