On 28 August 2010 23:49, David Leadbeater <dgl@dgl.cx> wrote: > This reminded me of some odd behaviour I had never had time to investigate. > > It's not really a precedence problem, the suggested workaround of adding parens > doesn't exactly work: > > (1,2,3) ~~ [1..3] # true > (3) ~~ [1..3] # true > (3,3,1) ~~ [1..3] # false > > This is because this compares the last item of the LHS with the array and 3 ~~ > [1..3] is true. > > Looking at how smartmatch works underneath it actually takes a reference to the > array at op generation time (by calling ref_array_or_hash in op.c, B::Deparse > will show you). This function doesn't seem to take array slices into account. > > Patch attached. Although I'm not sure I like the approach of teaching > ref_array_or_hash to return an anonlist for slices, although it does seem to > work. Thanks, applied to bleadperl as 329a333e7a4ed898282bec7f485751efbea92e8f.Thread Previous