From: Jenn Fo Date: 2013-07-30T21:40:19+09:00 Subject: Question about arrays/hash Hi All: I am new to ruby so I am stuck on a piece of code. I am trying to create a plugin check (see below). The end result if a failed drive or drives are present to print the following: Failed Drive: 1I:1:2, 1E:3:24 However, due to the way I wrote the code, it's only including the first drive. I would appreciate any tips on what I should be doing! :D def check_array slots=%x[/usr/sbin/hpacucli controller all show] slots.each_line do |s| s =~ /([Slot ][\d]{1,2})/ no = $1 no = no.lstrip if no drives=%x[/usr/sbin/hpacucli controller slot=#{no} physicaldrive all show] drives.each_line do |line| drive =[] f = /([0-9]{1,2}[a-zA-Z]{1,2}:[0-9]{1,2}:[0-9]{1,2})(.*)Failed(.*)/.match(line) drive << f.captures[0] if f end critical "Failed Drive: #{drive}" end -- Posted via http://www.ruby-forum.com/.