2009/6/9 Rob Biedenharn <Rob / agileconsultingllc.com>: > On Jun 9, 2009, at 8:52 AM, Peter Bailey wrote: > >> Hi, >> In the "pickaxe" book I see how to use a "puts" to populate a file with >> data. I try the same thing, and, it works, but, it's listing the data as >> an array. How can I get separate lines for each item in the array? >> Thanks, >> Peter >> >> In the book: >> File.open("output.txt", "w") do |file| >> file.puts "Hello" >> file.puts "1 + 2 = #{1+2}" >> end >> # Now read the file in and print its contents to STDOUT >> puts File.read("output.txt") >> produces: >> Hello >> 1 + 2 = 3 >> >> My script: >> Dir.chdir("L:/png/69000") >> files = Dir.glob("*.png") > > Dir.glob returns an Array >> >> File.open("F:/workflows/graphics/receipts/pngfiles.txt", "w") do |file| >> ¨Βιμε®πυτσ Ά£ϋζιμεσύΆ >> end > > The default Array#to_s is like Array#join(''). ¨Βου πςοβαβμω χαξτ το δο > either: > ¨Βιμε®πυτσ ζιμεσ®κοιξ¨ΆάξΆ© > or iterate on the files: > ¨Βιμεσ®εαγδο όπξηζιμεξανε> ¨Βιμε®πυτσ πξηζιμεξαν> ¨Βξδ It's even simpler: file.puts files Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/