# Re: Ruby Newbie - array/hash help

**URL:** <https://www.ruby-forum.com/t/re-ruby-newbie-array-hash-help/67759>\
**Category:** Ruby\
**Created:** [September 6, 2006, 5:00pm UTC](https://www.ruby-forum.com/t/re-ruby-newbie-array-hash-help/67759 "2006-09-06T17:00:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [September 6, 2006, 5:00pm UTC](https://www.ruby-forum.com/t/re-ruby-newbie-array-hash-help/67759/1 "2006-09-06T17:00:15Z")

</div>

> I’ve been doing research, but I can’t make heads or tails of it. Any  
> assistance would be greatly appreciated.

data\_sources.keys.each{ |table\_name|

# some\_code

}

This communication is the property of Qwest and may contain confidential  
or  
privileged information. Unauthorized use of this communication is  
strictly  
prohibited and may be unlawful. If you have received this communication  
in error, please immediately notify the sender by reply e-mail and  
destroy  
all copies of the communication and any attachments.

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [September 6, 2006, 5:14pm UTC](https://www.ruby-forum.com/t/re-ruby-newbie-array-hash-help/67759/2 "2006-09-06T17:14:17Z")

</div>

On Sep 6, 2006, at 9:51 AM, Berger, Daniel wrote:

> data\_sources.keys.each{ |table\_name|
> 
> # some\_code
> 
> }

Or:

data\_sources.each\_key { |table\_name|  
# …  
}

James Edward G. II

---

<div class="post-metadata">

**Author:** ![BergerS\_Daniel](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/bc8723/32.png) [@BergerS\_Daniel](https://www.ruby-forum.com/u/BergerS_Daniel)\
**Post date:** [September 6, 2006, 5:22pm UTC](https://www.ruby-forum.com/t/re-ruby-newbie-array-hash-help/67759/3 "2006-09-06T17:22:18Z")

</div>

\<…\>

> data\_sources.keys.each{ |table\_name|
> 
> # some\_code
> 
> }

Or:

data\_sources.each\_key { |table\_name|  
#some code  
}

Regards,  
Rimantas
