develooper Front page | perl.beginners | Postings from December 2002

Re: reverse?

Thread Previous
From:
Chris Game
Date:
December 1, 2002 09:57
Subject:
Re: reverse?
Message ID:
asdicp$28p$1@main.gmane.org
In an earlier post, Rob Dixon  wrote:

> Chris
>
>     scalar reverse "forwards" is the same as
>     scalar reverse ( "forwards" )
>     It explicitly puts the call to reverse() into scalar context.
Whereas
>     reverse scalar "forwards" is the same as
>     reverse ( scalar "forwards" )
>     which only forces the already scalar string "forwards" to be
scalar.

> When called in scalar context, reverse() reverses the characters in
> its parameter list. If called in list context, it returns the list
> itself in reverse order. So that
>     ( reverse ( "abcd", "efgh" )      gives      ( "efgh", "abcd" )

> while

>     scalar reverse ( "abcd", "efgh" )      gives      "hgfedcba"

OK, thanks Rob and Paul, I've got it now.
-- 
===========================================

Chris Game <chrisgame@!yahoo!dotcodotuk>
===========================================





Thread Previous


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About