How 'bout
sub drill_down { my $i=@_/2; @_[ @_%2 ? $i : ($i-1, $i) ]; }
instead?
Also, in various order:
would have sufficed in both cases;return @_ if @_ < 3;
instead ofdrill_down(@sorted); # as the last statement in your sub
my @middle = drill_down(@sorted); return @middle;
In reply to Re: function that returns the middle of an array
by blazar
in thread function that returns the middle of an array
by tcf03
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |