From: Christian von Kleist Date: 2007-12-04T01:42:09+09:00 Subject: Re: read file and print contents - beginner On Dec 3, 2007 11:16 AM, Johnathan Smith wrote: > I've changed my approach as i dont actually want to count the lines > > so i now have this: > > ARGV.each do |fn| > begin > (fn == 'reference.txt' ? STDIN : File.open(fn)).each_line do |l| > puts l > end > > by this im trying to read in the text file and print out its contents > > i seem to be getting a load error > any reason why? > > thank you > -- > > Posted via http://www.ruby-forum.com/. > > You're missing two `end` lines: ARGV.each do |fn| begin (fn == '-' ? STDIN : File.open(fn)).each_line do |l| puts l end end end Sorry, I thought we were just looking at a fragment of your code before, so I didn't comment on the missing `end` lines.