Sign in to PrePAN



Systems administrator new to CPAN and keen to start contributing.

GitHub: x2Xt9yTfjgA5Q49U PAUSE ID: TEJR URL:

User's Modules

List::Breakdown Build list sublists matching conditions

EDIT: I have now added this module to CPAN:

This module "breaks down" a list--filtering elements from a list into a specified bucket layout. It may be useful in situations where you have a big list of things to generate reports on or to otherwise filter into several sublists.

It differs from the excellent List::Categorize in the use of subroutine references for each category and in not requiring only one final category for any given item; an item can end up in the result set for more than one filter.

You could maybe think of this as a multi-grep that returns named results.

The synopsis code produces this structure in %filtered:

    all => ['foo', 'bar', 'baz', 'quux', 'wibble', 'florb'],
    has_b => ['bar', 'baz', 'wibble', 'florb'],
    has_w => ['wibble'],
    length => {
        3 => ['foo', 'bar', 'baz'],
        4 => ['quux'],
        long => ['wibble', 'florb'],
    has_ba => ['bar', 'baz'],

The module is written and working, with a basic test suite, and can be downloaded and browsed here:

x2Xt9yTfjgA5Q49U@github 0 comments