List::PartList::Part is a Perl module that allows you to partition one array into several. | |
Download |
List::Part Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Brent Dax
- Publisher web site:
- http://search.cpan.org/~brentdax/Perl6-Interpolators-0.03/Interpolators.pm
List::Part Tags
List::Part Description
List::Part is a Perl module that allows you to partition one array into several. List::Part is a Perl module that allows you to partition one array into several.SYNOPSIS use List::Part; ($good, $bad)=part { !/substring/ } @array; #store arrayrefs into $good and $bad (*good, *bad)=part { !/substring/ } @array; #store into @good and @badABSTRACTList::Part implements the part function, allowing one array to be "partitioned" into several based on the results of a code reference.There are many applications in which the items of a list need to be categorized. For example, let's say you want to categorize lines in a log file: my($success, $failure)=part { /^ERR/ } ;Or, suppose you have a list of employees, and you need to determine their fate: my($lay_off, $give_raise, $keep)=part { $_->is_talented ? 0 : $_->is_executive ? 1 : 2 } @employees;Actually, the second one is better suited to part's alternate form, parta: my($lay_off, $give_raise, $keep)=parta => @employees;Or maybe you just want yet another way to write the traditional Perl signoff: perl -MList::Part -e"print map{@$_}part{$i++%5}split'','JAercunrlkso ettPHr hea,'"List::Part can help you do those sorts of things.Requirements:· Perl Requirements: · Perl
List::Part Related Software