Uri Guttman wrote:

> so what that attribute does is force the hash to keep all pairs as
> single objects. but what about run time control of it? sometimes you
> might want a list of pairs to be handled like pairs and other times you
> want pairs to be scalars in a hash assignment. is there any way to
> manage that?

Sure. Just use the pairs as explicit keys and values:

        # Pairs as key/values...
        %hash = (a=>1, b=>2);
        %hash = @pairs;

        # Pairs as keys and then values...
        %hash{a=>1} = b=>2;
        for @pairs -> $k, $v { %hash{$k} = $v }
        

Damian


Reply via email to