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

User-defined behaviour of hashes in list context

Thread Next
From:
Ingo Blechschmidt
Date:
July 20, 2005 05:51
Subject:
User-defined behaviour of hashes in list context
Message ID:
dblhar$o7f$1@sea.gmane.org
Hi,

according to Damian [1]...:

    my %hash  = (a => 1, b => 2);
    my @array = %hash;
    say @array[0].isa(Pair);  # true

How can I override this behaviour?

    class MyHash is Hash {
        # Please fill in here
    }

    my %hash is MyHash = (a => 1, b => 2);
    my @array          = %hash;   # should call my own routine


--Ingo

[1]
http://groups.google.de/group/perl.perl6.language/msg/dc552000b7c6191e

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