my @data = qw/a mnk ab m b bc abcd cd bcd bd m nk /; my $prev = ''; @data = grep { substr($prev, 0, length) ne $_ and ($prev = $_,1) } reverse sort @data;
update: Whoops, I hought it was initial substrings. Thanks ikegami for pointing out my foolishosity!
Dave.
In reply to Re: Seeking the longest string in an array
by dave_the_m
in thread Seeking the longest string in an array
by johnnywang
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |