Hi,

I'm trying to create a one-element array containing a hash. I eventually
managed to do this from the REPL, but when I create a script containing the
same commands, it doesn't work.

    $ cat test.p6
    my %h = (y => 1, x => 1);
    say [item %h].elems;
    say [item %h][0].WHAT;
    $ perl6 test.p6
    2
    (Pair)
    $ cat test.p6 | perl6
    > my %h = (y => 1, x => 1);
    ("x" => 1, "y" => 1).hash
    > say [item %h].elems;
    1
    > say [item %h][0].WHAT;
    (Hash)
    >
    $ perl6 -v
    This is perl6 version 2014.04 built on parrot 6.1.0 revision 0

`cat test.p6 | perl6` does what I expect it to, but `perl6 test.p6` seems
to be flattening the hash into the array despite the 'item'.

Is this a bug, or am I missing something? (I don't claim much understanding
of how this *should* work, but getting two different behaviours feels
wrong.)

On a whim, I tried to replace 'item %h' with '%h.item', and both methods of
execution now give the results I was expecting, i.e. "1" and "(Hash)".

Reply via email to