in reply to Re^2: normal array exists question
in thread normal array exists question

JanneVee,
The tutorial covers a bit of this, but I will go into more depth here. List::Util's first is designed to generic and portable. It is prototyped to $@ where the first argument is the code reference that will be applied to the remaining items in the list. It starts at the beginning and returns as soon as the code ref evaluates to true. This does not need to be an exact match as you could use a regex in block for instance. It does have a couple of issues with regards to efficiency. Now you can roll your own to be more efficient but that defeats the purpose of having portable re-useable code. Additionally, shaving a second or two off of run time is seldom worth the programmer time required to achieve it.

Cheers - L~R