On May 4, 2006, at 8:34 AM, Gregory Seidman wrote:

> I have gotten pretty good with Ruby and I *can* duplicate this in  
> about 10
> seconds:
>
> input = (ARGV.length>0) ? File.new(ARGV[0]) : $stdin

If you change that to:

input = ARGF

You get the same behavior, but can accept multiple argument files on  
the command-line.

> arr = []
> input.each_line { |line| arr << line }

Usually when you iterate and collect like this, it's a sign that you  
really want a different method (readlines() or to_a() in this case).

James Edward Gray II