Peter Loftus wrote:
> arr = Array.new
> i = 0
> File.foreach(example.txt) do |line|
>  arr[i] = line
>  i += 1
> end

arr = File.readlines("example.txt")
Does the same as the code above, but is far more compact.

> arr.each do |item|
> if (arr.to_s.split("\t")[2] = "example 3")
>  puts "found it"
> end
arr.to_s will give you the whole content of the file. You want to use item.

arr.map! {|line| line.split("\t")[2]}
arr.each_with_index do |field, i|
  if field
    puts "Found field #{field} in line #{i}"
  else
    puts "No third field in line #{i}"
  end
end


HTH,
Sebastian
-- 
Jabber: sepp2k / jabber.org
ICQ: 205544826