++ed by:
2 non-PAUSE users
Author image Christian Walde
and 1 contributors


Array::Split - split an array into sub-arrays


version 1.173190


    use Array::Split qw( split_by split_into );


This module offers functions to separate all the elements of one array into multiple arrays.

split_by ( $split_size, @original )

Splits up the original array into sub-arrays containing the contents of the original. Each sub-array's size is the same or less than $split_size, with the last one usually being the one to have less if there are not enough elements in @original.

split_into ( $count, @original )

Splits the given array into even-sized (as even as maths allow) sub-arrays. It tries to create as many sub-arrays as $count indicates, but will return less if there are not enough elements in @original.

Returns a list of array references.


  • Christian Walde (MITHALDU) <walde.christian@gmail.com>

  • Tomasz Konojacki (XENU) <me@xenu.tk>


Christian Walde has dedicated the work to the Commons by waiving all of his or her rights to the work worldwide under copyright law and all related or neighboring legal rights he or she had in the work, to the extent allowable by law.

Works under CC0 do not require attribution. When citing the work, you should not imply endorsement by the author.