Jeff Schwab
5/16/2006 10:11:00 AM
ts wrote:
>>>>>> "W" == William James <w_a_x_man@yahoo.com> writes:
>
> W> A perl user alleged that under Unix:
>
>>> That will print out the file contents and then wait for more input from stdin
>>> so you have to follow it with ^D to signal EOF.
>
> no, no : it don't wait for more input from stdin.
>
> it read from stdin *only* if you don't give argument to the command.
Yep. It's also buggy: when multiple files are given, the gets() will
read the first line of each file after the first, i.e. it will try to
read one line from *ARGF /after/ the end of each individual ARGF file.
To get the intended behavior, you may want something like this:
ruby -pe '' file* -
Btw, please don't hold this against all Perl users. Despite the amount
of libel Perl suffers in Ruby and Python groups, it is actually a
wonderful language.