Acme::Eatemup - A list chopper
0.01
print foo(), yumyum; # all but the last element print foo(), eatemup; # same
Have you ever needed all but the last two items of a list? Have you ever been annoyed that Perl's (...)[...] list slice has no way for you to specify that without knowing the number of items? Then this module is for you. Before, you would have to write:
(...)[...]
my @tmp = foo(); print @tmp[0..$#tmp-2]; # ugly
Or:
my @tmp = foo(); pop @tmp, pop @tmp; # or splice @tmp, -2 print @tmp; # THREE lines!
With this module, you can simply eat them off the list:
use Acme::Eatemup; print foo(), yumyum, eatemup;
$,=",",$\="\n"; sub eat(){goto z;not 1 .do{z:1}} print 1,2,eat,3,4;
Output:
1,,3,4
This module requires perl 5.004 or later. Whether it actually works that far back I have not verified. (The earliest I tested it with was 5.8.7.)
There is no check to see whether you are eating more items off the list that are present. When used carelessly, this module can crash perl.
Please report bugs to bug-Acme-Eatemup@rt.cpan.org.
Copyright (C) 2008, 2010, 2012, 2016 Father Chrysostomos (sprout at, um, cpan dot org)
This program is free software; you may redistribute or modify it (or both) under the same terms as perl.
Routes::Tiny
To install Acme::Eatemup, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Acme::Eatemup
CPAN shell
perl -MCPAN -e shell install Acme::Eatemup
For more information on module installation, please visit the detailed CPAN module installation guide.