Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
There are a couple of modules that you can use if you need fancier list handling in Perl. After all, many programs really are just a series of moving lists around in various ways.
The List::Util module comes with the Standard Library and provides
high-performance versions of
common list processing utilities. These are implemented at the C
level.
Suppose you wanted to know if a list contains an item that matches
some condition. You don’t need to get all of the elements, and you want
to stop once you find the first matching element. You can’t use grep because it always scans the entire list,
and if your list is very long the grep might do a lot of extra, unnecessary
work: