From the keyboard of Rick Delaney [03.05.04,09:42]: > On Mon, May 03, 2004 at 03:27:01PM +0200, Georg Moritz wrote: > > From the keyboard of Rick Delaney [03.05.04,09:23]: > > > > > while (my @a = map { eof() ? () : scalar <> } 1 .. $n) { > > > print @a; > > > print "SEPARATOR\n"; > > > } > > > > but this will loop forever, since the array @a is always defined, even > > on eof(). map() will return a bunch of undefs. > > What makes you say that?
well, I assumed it by perl -le 'print scalar map{undef} 1..4' 4 but then.. perl -le 'print scalar map{()} 1..4;' 0 how subtle. once again, nothing and nothing aren't the same... an empty list doesn't increase the array count on the lhs. undef does. obviously undef returns a scalar value (which is undef). thanks, georg -- _($_=" "x(1<<5)."?\n".q·/)Oo. G°\ / /\_¯/(q / ---------------------------- \__(m.====·.(_("always off the crowd"))."· ");sub _{s,/,($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e,e && print}