@array = qw( hello, superduper, hi )
Maybe it's a mistake, but this creates a list containing three comma ending strings.
For your algorithm you should have a look at the implementation of minmax in List::MoreUtils. It should be simple to adjust it to check for the length of a string. The documentation says:
The minmax algorithm differs from a naive iteration over the list where each element is compared to two values being the so far calculated min and max value in that it only requires 3n/2 - 2 comparisons. Thus it is the most efficient possible algorithm.
--Frank
In reply to Re: Finding the Shortest Element in an Array
by haoess
in thread Finding the Shortest Element in an Array
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |