In the interest of writing cleaner code...
IO.popen("Generate a list of files").readlines.each{ |line|
chomped_line = line.chomp
# ...
}
IO.read("something").split($/)
$/ is the separator string. IO.read closes the file after reading.