develooper Front page | perl.perl5.porters | Postings from July 2013

Re: postfix dereference syntax

Thread Previous | Thread Next
Mark Allen
July 3, 2013 15:13
Re: postfix dereference syntax
Message ID:
+1 from the peanut gallery, for whatever that's worth.

 From: David Golden <>
To: Dave Mitchell <> 
Cc: Ricardo Signes <>; p5p <> 
Sent: Wednesday, July 3, 2013 10:02 AM
Subject: Re: postfix dereference syntax

On Wed, Jul 3, 2013 at 10:23 AM, Dave Mitchell <> wrote:
>     expr->[]
>     $a->[1,5,7]

This is even more attractive to me when considered together with
normal element access:

    $array->[]; # dereference
    $array->[$i]; # single element
    $array->[@list]; # array slice

    $hash->{}; # dereference
    $hash->{$n}; # single element
    $hash->{@list}; # hash slice

It bugs me slightly that [] and {} look "empty" when in fact they
return everything, but I like the parallelism more than I fear that
visual confusion.  That table above is easy to teach and easy to

Would we allow whitespace between [] and {}?  Or would we treat them
like a type of operator and insist that they be without a space?


David Golden <>
Take back your inbox! →
Twitter/IRC: @xdg
Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About