in reply to using pop a lot

splice():
splice @array,-5,5,();
A directly executable example:
$ perl -e '@a=(1,2,3,4,5);splice @a,-2,2,();print "@a\n"' 1 2 3

Liz

Replies are listed 'Best First'.
Re: using pop a lot
by Abigail-II (Bishop) on Oct 10, 2003 at 12:29 UTC
    Or shorter:
    splice @array => -5;

    Abigail

      Actually, it can still get shorter without splice():
      $#array -= 5;

      Liz

      Update:
      Although I would probably use Abigail-II's way, but without the fat comma:

      splice @a,-5;