* Abigail (abigail@abigail.be) [110902 14:08]: > I don't think "needs a scalar" actually means "will not accept an > array as argument". > > In fact, I consider the bug here to be: > $ perl -wE '@a = 2; exit @a; echo $?' > 1 But an array is not a scalar! An array is NOT the same thing as a list of scalars. > I actually expect this to print 2, and checking the manual page for exit, > there's actually nothing in it that suggests it's evaluating its argument > list in scalar context. Not only doesn't it say "needs a scalar", it doesn't > even mention the word "scalar": > > =item exit > Evaluates EXPR and exits immediately with that value. IMO, a "value" is not the same as "the first value of a list/array" So documented is that EXPR is expected to produce a single thing, which @x in POSIX::exit(@x) can only be if there is a prototype. OK, but that point has been raised a few times before. Can you also give your response to my counter argument that it is very unpleasant when use POSIX 'exit'; ... zillion lines of code ... exit(@x) differs from ... zillion lines of code ... exit(@x) Or even worse, with functions with a single scalar which change from being prefix operator priority into functions by a seemingly unrelated "use" statement... Of course, this is only a problem when you do not use parens for function calls (I like to have few parens, and Perl allows me to) (a similar horrific change when you add "use filetest" to the top of your program, which changes the behavior of every -r/-w/-x) -- Regards, MarkOv ------------------------------------------------------------------------ Mark Overmeer MSc MARKOV Solutions Mark@Overmeer.net solutions@overmeer.net http://Mark.Overmeer.net http://solutions.overmeer.netThread Previous | Thread Next