On Mon, Oct 5, 2009 at 5:24 PM, Jim Burgess <jack.zelig / gmail.com> wrote:
> I need to count the number of times an element occurs in an array.
>

just for fun

>> a = ["a", "b", "a", "b", "b"]
=> ["a", "b", "a", "b", "b"]
>> a.group_by{|x|x}.map{|x,y| [x,y.size]}
=> [["a", 2], ["b", 3]]

kind regards -botp