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

Re: key/value hash and index/valuse array slices syntax

Thread Previous | Thread Next
From:
Mark Overmeer
Date:
June 11, 2013 11:06
Subject:
Re: key/value hash and index/valuse array slices syntax
Message ID:
20130611110633.GY18336@moon.overmeer.net
* Leon Timmermans (fawaka@gmail.com) [130611 10:53]:
> my %first = (a => 1, b => 2);
> my %second = %first{qw/a c/};
> 
> Should %second now contain «c => undef», not no c at all? I think I'm
> currently leaning towards the latter, it seems like the more useful
> behavior to me.

Do we need this compact syntax, or can we get

  my %second = slice %first, qw/a c/;

Love to have it in code, maybe in List::Util.
(there already is a Hash::Slice)

And I still love to have a

  push %grow, @pairs;     # or
  merge $grow, @pairs;
-- 
Regards,

               MarkOv

------------------------------------------------------------------------
       Mark Overmeer MSc                                MARKOV Solutions
       Mark@Overmeer.net                          solutions@overmeer.net
http://Mark.Overmeer.net                   http://solutions.overmeer.net


Thread Previous | Thread Next


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