toapole has asked for the wisdom of the Perl Monks concerning the following question:
my @test = ( {id => 1}, {id => 2} );
my @arr = map $_->{id}, @test;
say 1 ~~ @arr;
and this doesn't (namely context in matching is scalar):
my @test = ( {id => 1}, {id => 2} );
say 1 ~~ map $_->{id}, @test;
?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: map and smart match
by ikegami (Patriarch) on Jul 09, 2009 at 22:41 UTC | |
by ikegami (Patriarch) on Jul 09, 2009 at 22:55 UTC | |
|
Re: map and smart match
by JavaFan (Canon) on Jul 10, 2009 at 10:57 UTC |