need help with variables and array

Hi All,

I am new to Ruby and doing some automation testing.

I am using Net::LDAP to connect to my ldap server My script is

require 'rubygems' require 'net/ldap'

ldap = :host => '',       :port => 389,       :auth => {             :method => :simple,             :username => "cn=Manager,dc=ibm,dc=com",             :password => "secret"       }

#if ldap.bind #puts ldap.inspect #else #puts ldap.get_operation_result.message #end

filter = Net::LDAP::Filter.eq( "mail", "" ) treebase = "dc=ibm,dc=com" attrs = ["userPassword"] :base => treebase, :filter => filter, :attributes => attrs ) do |entry|

   entry.each do |attribute, values|      values.each do |value|        puts "#{value}"

     end    end end

I am getting my expected result i.e.,ou=people,o=external,dc=ibm,dc=com lI6z#f5C

Now I want to save the value lI6z#f5C (which is attribute password) and in to 2 seperate variables say $passwd and $mail so that I can use these values for some other purpose.

Can anyone help me how can I do that.