How do I prevent List::MoreUtils from warning about using $a and $b only once?

前端 未结 6 1777
温柔的废话
温柔的废话 2020-12-15 06:08

The List::MoreUtils module indicates that you use the variables $a and $b when supplying the BLOCK that goes with the pairwise

6条回答
  •  死守一世寂寞
    2020-12-15 06:21

    This is probably a bug in List::Util.

    Turning off warnings globally is probably not a good idea, however you could do something like this:

    {
      no warnings 'once';
      return join("_", @monsters) if @monsters && List::Util::reduce { $a && $b // 0 > 0 } 1,@monsters;
    }
    

    This would turn off the relevant warning category for that part of the code only.

提交回复
热议问题