Path: utzoo!utgpu!news-server.csri.toronto.edu!bonnie.concordia.ca!uunet!mcsun!hp4nl!sci.kun.nl!cs.kun.nl!hansm From: hansm@cs.kun.nl (Hans Mulder) Newsgroups: comp.lang.perl Subject: Re: reverse foo('bar') Summary: many list operators have this problem Message-ID: <2678@wn1.sci.kun.nl> Date: 23 Jan 91 12:49:44 GMT References: <1991Jan21.194252.19124@convex.com> Sender: root@sci.kun.nl Organization: University of Nijmegen, The Netherlands Lines: 26 In article <1991Jan21.194252.19124@convex.com> tchrist@convex.COM (Tom Christiansen) writes: > > print reverse foo('bar'); > >says "bar", whereas > > print foo('bar'); > >says syntax error, as it (to my understanding) rightly should. >Why should the reverse make a difference? All list operators take an optional extra argument, separated from the list by optional whitespace. Print interprets this argument as a filehandle, sort takes it to be the sorting function. Reverse doesn't really know what to do with it, but doesn't complain either. Other list operators that ignore the optional extra argument are chmod, chown, kill, unlink, utime, die and return. Maybe the parser should be informed that list operators come in two kinds: those that use the extra argument, and those that don't. -- sub s { return Not yet, another, perl, hacker; } @s=&s; print "@s,\n"; Hans Mulder hansm@cs.kun.nl