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

Accessing a list literal by key?

Thread Next
From:
Ingo Blechschmidt
Date:
September 9, 2005 11:09
Subject:
Accessing a list literal by key?
Message ID:
dfsino$24q$1@sea.gmane.org
Hi,

    # Should this work?
    say (a => 1, b => 2)<b>;  # 2 or error?

    # Similarily:
    my @array = (a => 1, b => 2);
    say @array<b>;

    my $arrayref = [ a => 1, b => 2 ];
    say $arrayref<b>;

FWIW, I think accessing arrays and arrayrefs by key should probably not
work, but I'm unsure on (...)<b>.


(%hash[$numerical_index] is, of course, bogus, as hashes aren't ordered
by default.)


--Ingo

-- 
Linux, the choice of a GNU | Row, row, row your bits, gently down
generation on a dual AMD   | the stream...
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