From: Austin Ziegler Date: 2002-10-22T09:47:36+09:00 Subject: Re: functional Ruby equiv to this perl snippet Bob, Can you post your exact script that you're running? If I do the following: class FileNotFoundException < RuntimeError end def load_server_list(filename) servers = [] File.exist?(filename) or raise FileNotFoundException, filename File.open(filename).each do |line| next unless line =~ /^\S+$/ next if line =~ /^#.*$/ servers << line.chomp.sub(/\s+#.*$/, '') end servers end begin p load_server_list('serverlist.txt') p load_server_list('serverlist2.txt') rescue FileNotFoundException => fnf puts "File '#{fnf.message}' does not exist." exit end I get exactly what I'm supposed to get in both cases. I tried this with both 1.6.7 and 1.7.3. -austin -- Austin Ziegler, austin@halostatue.ca on 2002.10.21 at 20.43.59