NAME

Acme::Eatemup - A list chopper

VERSION

0.02

SYNOPSIS

print foo(), yumyum;  # all but the last element
print foo(), eatemup; # same

DESCRIPTION

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;

INSPIRATION

$,=",",$\="\n";
sub eat(){goto z;not 1 .do{z:1}}
print 1,2,eat,3,4;

Output:

1,,3,4

PREREQUISITES

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.)

BUGS

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.

AUTHOR & COPYRIGHT

Copyright (C) 2017 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.

SEE ALSO

Routes::Tiny