From: David Alan Black Date: 2002-08-01T21:43:13+09:00 Subject: Re: How to make a virtual 2nd column!!! Hi -- On Thu, 1 Aug 2002, Paul Duncan wrote: > # process each file passed on the command-line > # (ruby 1.7 can do this in a slightly more concise manner > # with File::readlines) > ARGV.each { |path| > File.open(path) { |file| > file.each { |line| > print_record(line, 35) > } > } > } File.readlines seems to work OK in 1.6.7: $ ruby -ve 'ARGV.each {|f| p File.readlines(f)}' file1 file2 ruby 1.6.7 (2002-03-01) [i686-linux] ["file 1 line 1\n", "file 1 line 2\n"] ["file 2 line 1\n", "file 2 line 2\n"] Most concise would probably be: ARGF.each {|line| print_record(line,35)} David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav