in reply to map and smart match

Because map $_->{id}, @test is not an array. say 1 ~~ @{[ map $_->{id}, @test ]}; should do the trick. I wonder if say 1 ~~ [ map $_->{id}, @test ]; also works.

Replies are listed 'Best First'.
Re^2: map and smart match
by ikegami (Patriarch) on Jul 09, 2009 at 22:55 UTC

    The passage I bolded from what is to be 5.10.1's perlsyn answers my own question:

    The behaviour of a smart match depends on what type of thing its arguments are. The behaviour is determined by the following table: the first row that applies determines the match behaviour (which is thus mostly determined by the type of the right operand). Note that the smart match implicitly dereferences any non-blessed hash or array ref, so the "Hash" and "Array" entries apply in those cases. (For blessed references, the "Object" entries apply.)