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

Re: Regex query

From:
matt diephouse
Date:
September 20, 2002 13:54
Subject:
Re: Regex query
Message ID:
3D8B8B7C.8000003@diephouse.com
  John Williams wrote:

>On Fri, 20 Sep 2002, Larry Wall wrote:
>  
>
>>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).
>>    
>>
>
>I was just thinking that  $((1,2,3))  is also the same as  [1,2,3],
>and shorter than  scalar(1,2,3).
>
I wonder if you can't just use $(1, 2, 3) to the same effect. Also, I 
wonder if you can do this:

my @LoL = ( ("1a", "2a"),
                         ("1b", "2b"),
                         ("1c", "2c") );

If you can, the only case where I could see [1, 2, 3] being necessary is 
in a sub call where the parameters are wrapped in parentheses.

    md |- matt diephouse




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