Problem with Hpricot and attributes

I am trying to run the following code:

require 'rubygems' require 'hpricot' require 'open-uri'

doc = Hpricot(open("****the url is here***")) tables =(doc/"table") (tables[6]/"tr").each do |major|   name = major.search("td").first.inner_html   abbrev =major.search("acronym").inner_html   link = major.search("a")   path = link.attributes['href']   puts path end

Everytime I run it, I get this error though: undefined method `attributes' for #<Hpricot::Elements> (NoMet hodError)

Am I missing something?

#search always returns an array of elements, even if it only found one.

Use #at if you only want the first element.

http://code.whytheluckystiff.net/hpricot/