[#3986] Re: Principle of least effort -- another Ruby virtue. — Andrew Hunt <andy@...>

> Principle of Least Effort.

14 messages 2000/07/14

[#4043] What are you using Ruby for? — Dave Thomas <Dave@...>

16 messages 2000/07/16

[#4139] Facilitating Ruby self-propagation with the rig-it autopolymorph application. — Conrad Schneiker <schneik@...>

Hi,

11 messages 2000/07/20

[ruby-talk:04153] ARGF and line numbers

From: Dave Thomas <Dave@...>
Date: 2000-07-21 02:26:45 UTC
List: ruby-talk #4153
If I have a loop such as

   ARGF.each_line do |line|

      # ...

   end

and I invoke the program with

   ruby dave.rb one two three

then as I read through the files, $FILENAME changes to reflect the
file being read from. However, $. and ARGF.lineno do not get reset to
zero at the start of each file.

I can see arguments both ways, but right now I'm favoring a line
number that reflects an offset into the current file, rather than the
total number of lines read. What do people think?


Regards


Dave

In This Thread

Prev Next