in reply to Seeking the longest string in an array

The problem with these solutions is they all require nested comparisons of text. It's much better to require only one comparison per item, and also to only require searching of text that has already been validated as being unique. You do this as follows:
use strict; use warnings; my @data = qw/a mnk ab m b bc abcd cd bcd bd m nk/; (my $result, @data) = sort {length($b) <=> length($a)} @data; for (@data) { $result .= ' '.$_ if index($result, $_) == -1; } print $result;
I think you'll find that this method easily beats any other in both processing speed and coding efficiency.