On Sat, Nov 30, 2002 at 09:55:19PM -0000, Chris Game wrote:
> In an earlier post, Paul Johnson  wrote:
> 
> > On Sat, Nov 30, 2002 at 09:26:29PM -0000, Chris Game wrote:
> >
> >> Can anyone explain why
> >> perl -e 'print reverse "forwards" ' prints "forwards"; and to get
> >> what I want I have to use
> >> perl -e 'print $var= reverse "forwards" ' which yields "sdrawrof" ?
> >> Why do I have to introduce the extra variable just to get the print
> >> I was after?
> >
> > Because your first example is in list context.
> >
> > perl -e 'print scalar reverse "forwards"'
> 
> Blimey that was quick! Thanks for the response Paul. Why doesn't

:-)

> perl -e 'print reverse scalar "forwards" ' work (I tried that earlier)?

Because you want reverse to be in scalar context, not its arguments.

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to