You would get a lot of support in Perland, but this kind of code is
very out of fashion in the Ruby community.
I can see, for readability's sake, wanting to avoid non-explicit data
handling like using "print" with no argument. Yes, that's the sort of
thing that allows three lines of Perl to do the same work at a dozen or
more of many other languages, but it's not very clear and is easy to
break later when maintaining the script.
I don't see any particular reason to regard "ARGF.each do |elem|" as
better than "while gets", though. The latter of the two is more like
natural language, reads clearly, and is pretty much intuitively
understandable even to people who have never touched the language
before. As I understand it, the "Ruby way" tends toward simplicity,
elegance, and ease of reading, writing, and maintaining. From what I
can see, "while gets" satisfies those preferences better than "ARGF.each
do |elem|". In fact, I'd say that regardless of whether "ARGF.each do
|elem|" is what "everyone uses", it is "while gets" that seems to best
suit the spirit of the "Ruby way".
. . and even if I'm missing some esoteric point regarding how the
language works, and the way "while gets" operates does NOT suit as well
as I think at first glance, perhaps it SHOULD.
Please let me know if I'm missing something. I've got a head full of
snot today, and the sinus pressure might just be making me stupid.