[#1816] Ruby 1.5.3 under Tru64 (Alpha)? — Clemens Hintze <clemens.hintze@...>

Hi all,

17 messages 2000/03/14

[#1989] English Ruby/Gtk Tutorial? — schneik@...

18 messages 2000/03/17

[#2241] setter() for local variables — ts <decoux@...>

18 messages 2000/03/29

[ruby-talk:01895] File operations

From: "David Douthitt" <DDouthitt@...>
Date: 2000-03-16 16:20:09 UTC
List: ruby-talk #1895
I'm looking at file operations, and am getting confused - yet I may be running into "TMTOWTDI" :-)

"There's More Than One Way To Do It" :-)

What is the difference between File.open (open method of File class) and internal function open?

What is the difference between the IO methods each and each_line?  And how does

File.open(path).each_line { |line|
   ...
   }

differ from

File.open(path) { |f|
   f.readlines.each { |line|
      ....
      }
   }

???

I know at least that the first reads one line at a time from the file, and the second reads the file into an array and iterates over the array..... at least I think so.


In This Thread

Prev Next