develooper Front page | perl.perl6.language | Postings from July 2005

Hash creation with duplicate keys

Thread Next
From:
Ingo Blechschmidt
Date:
July 20, 2005 05:44
Subject:
Hash creation with duplicate keys
Message ID:
dblgrm$mpg$1@sea.gmane.org
Hi,

    # Perl 5
    my %hash = (a => 1, b => 2, a => 3);
    warn $hash{a};   # 3

But I vaguely remember having seen...:

    # Perl 6
    my %hash = (a => 1, b => 2, a => 3);
    say %hash<a>;    # 1

Can somebody confirm this?


--Ingo

-- 
Linux, the choice of a GNU | Mathematicians practice absolute freedom.
generation on a dual AMD   | -- Henry Adams  
Athlon!                    | 


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