[Milan-pm] [Lisbon.pm] Is this a feature or a bug?
Paulo
pmca.pm at clix.pt
Thu Apr 29 11:30:31 PDT 2010
I think it's a bug in "any" ...
Try this:
my $_ = 5;
say( (any { $_ eq 7 } (0..10) ) or 'false' );
given (5) {
when (5) {
say( (any { our $_ eq 7 } (0..10) ) or 'false' );
say( join(", ", map { $_ eq 7 } (0..10) ) );
}
}
and it prints:
false
1
, , , , , , , 1, , ,
Best regards
On Thu, 2010-04-29 at 17:56 +0200, marcos rebelo wrote:
> the code:
>
> use v5.10;
> use Modern::Perl;
> use List::MoreUtils qw(any);
>
> say( (any { $_ eq 7 } (0..10) ) or 'false' );
>
> given (5) {
> when (5) {
> say( (any { $_ eq 7 } (0..10) ) or 'false' );
> say( join(", ", map { $_ eq 7 } (0..10) ) );
> }
> }
>
>
> prints:
>
> 1
> false
> , , , , , , , 1, , ,
>
>
>
> the second 'any' should have returned a true value or not, and why???
>
>
> Best Regards
> Marcos Rebelo
>
More information about the Milan-pm
mailing list