From: Jens Rohde Date: 2001-10-09T17:36:28+09:00 Subject: [ruby-talk:22287] What's wrong with these Arrays? Hi ruby-hackers I'm working on a script that are supposed to analyse the logfiles from my cisco PIX firewall. One of the tasks is to find the first and the last date a given ip-address has done a violation. For that I've produced the following code: theIP.each do |plof| # Traverse the list with violating IP's sql = "select date from pixlog where srcIP = \"#{plof}\" order by date" getData = @dbHandle.prepare(sql); getData.execute tempArray = Array.new while tempVar = getData.fetch do tempArray.push(tempVar) end firstDate = tempArray[0].to_s lastDate = tempArray.last.to_s @report.push("From "+firstDate+" to "+lastDate+" "+plof+" ... end For some reason tempArray alwas seems to be filled with the last value delivered by the getData-fetch command. What am I missing here? Kind regards.... -- Jens Rohde, System Administrator ----------------------------------------------------------------------- Eastfork Object Space (EOS), Margrethepladsen 3, 8000 Aarhus C, Denmark Tel: +45 8732 8787 / Fax: +45 8732 8788