develooper Front page | perl.perl6.language | Postings from September 2002

Re: Regex query

From:
Larry Wall
Date:
September 20, 2002 09:24
Subject:
Re: Regex query
Message ID:
Pine.LNX.4.44.0209200916360.31624-100000@london.wall.org
On Fri, 20 Sep 2002, John Williams wrote:
: On Fri, 20 Sep 2002, Larry Wall wrote:
: >
: > Yes, in fact any list forced into scalar context will make a ref in Perl 6:
: >
: >     $arrayref = (1,2,3);
: 
: That would seem to obviate the need for brackets to define array
: references.  Is there any case where [1,2,3] would be needed instead of
: (1,2,3)?

Sure, in a list context.  [1,2,3] is really short for scalar(1,2,3).

: Also, does "any" list include a list of pairs?  Because that would look
: more like a hash than a list.
: 
:       $ref = ( one => 1, two => 2, three => 3);

Sure.  If you really want a hash, use {...}.  (Extra rules apply
for parameter lists, though.)

Larry




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