Hope that helps. Here is the documentation on what is going on with the Schwartzian Transform.#!/usr/bin/perl -w use strict; my @array = qw(hello superduper hi); #our good friend the ST (aka: Schwartzian Transform) my $shortest = shift @{[ map{$_->[1]} sort{$a->[0] <=> $b->[0]} map{[length $_, $_]}@array ]}; print $shortest;
In reply to Re: Finding the Shortest Element in an Array
by injunjoel
in thread Finding the Shortest Element in an Array
by awohld
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |