So if I were to write that bit of Perl code I posted about 3 days ago in Ruby (using the additional functionality provided by Rails), it would look like this:

hash = Hash.from_xml(res.content)
service_id = hash['service']['id']
hash['service']['activities'].each do |item|
  if item['name'] == activity
    activity_id = item['id']
    break
  end
end

I’m fairly certain that code is an accurate translation of the Perl snippet, but without reproducing the same situation, I can’t guarantee it. The point is, it is representative of Ruby code, and its significantly more readable syntax.