Björn Höhrmann

NAME

List::EachCons - Apply code to each array element and a block of successors

SYNOPSIS

  use List::EachCons;
  my @list = qw/a b c d/;
  each_cons 3, @list, sub {
    say "@_";
  };
  # a b c
  # b c d
  

DESCRIPTION

This module provides the function each_cons.

FUNCTIONS

each_cons($size, $array, $code)

If $array has at least $size elements then this function calls $code for each element in $array with $size consecutive elements from the array as argument in the order of elements in the array. Returns a list of return values from invoking the code reference.

EXPORTS

each_cons by default.

AUTHOR / COPYRIGHT / LICENSE

  Copyright (c) 2014 Bjoern Hoehrmann <bjoern@hoehrmann.de>.
  This module is licensed under the same terms as Perl itself.