From: ts Date: 2002-10-22T02:14:34+09:00 Subject: Re: functional Ruby equiv to this perl snippet >>>>> "B" == Bob writes: B> # parses a text file looking for server names and ignoring lines B> # with start with the pound/hash sign. and ignoring empty lines, no ? B> I am trying to convert a perl script I like to Ruby and I am not very B> good at either! Something like this, it return an array def load_server_list(filename) servers = [] IO.foreach(filename) do |line| next if line[0] == ?# || line[0] == ?\n servers << line.chomp end servers rescue raise "Can't open #{filename} : #$!" end to use it servers = load_server_list("serverlist.txt") servers.size will give the same than $server_count Guy Decoux