In article <[EMAIL PROTECTED]>, Michael W Thelen <[EMAIL PROTECTED]> writes: > On Tue, Jun 25, 2002 at 12:25:20PM +0200, Beno�t Chauvet wrote: >> Yes, but have you tried this ? >> -p ($_)=sort{abs$_-$a<=>abs$_-$b}<> (35) > I like this solution, but after processing the input lines, it hangs waiting > for more input. I was curious as to why this was happening, and found this in > perlop: > The <> symbol will return "undef" for end-of-file only > once. If you call it again after this, it will assume you > are processing another @ARGV list, and if you haven't set > @ARGV, will read input from STDIN. > Is a Golf program required to terminate? Amir referred to MLM emails (what are > those?) saying that using <> inside a -p loop is legal. What's the official > call on this one?
The challenge says the data comes from stdin, not the first file argument. so if you run it as perl program < file, it will give EOF again on consecutive reads. If you type data on a tty, you'll have to press ^D twice indeed. On the ircnet golfs we've decided to say that once a stream is at EOF, it remains at EOF, so we declare this valid. I'll give a bit more time for people to find the mtv 32
