in reply to Finding the Shortest Element in an Array
Edit: looks like i was way to slow again.my @a = qw(4444 22 1 22 333); my $shortest; my $min; for ( @a ) { my $l = length($_); if (not defined $min or $l<$min ) { $min=$l; $shortest=$_; } } print $shortest;
|
|---|