This is actually a bug from Perl 5, but Perl 5's given  is supposed to
act like Perl 6's given. The long post is in use.perl:

   http://use.perl.org/~brian_d_foy/journal/35682

I was playing with a when condition that used a logical operator to see
if the topic was both an element of an array and a key of a hash:

   given( $foo ) {
      when( @array && %hash ) { ... }
      }

I thought that should acting like two smart matches:

   given( $foo ) {
      when(  (@array ~~ $_) && (%hash ~~ $_) ) { ... }
      }

In Perl 5.10.0, it's acting like one smart match, which I'm pretty sure
is a bug:

   given( $foo ) {
      when(  ( scalar @array and scalar %hash ) ~~ $_) ) { ... }
      }

Perl 5's perlsyn talks about smart matching with logical operators, but
I don't see that in S04 (or anywhere else). Knowing what is supposed to
happen in Perl 6 would help me fix the Perl 5.10 version. 

So what would Perl 6 do (WWP6D) ? :)

Reply via email to