- or download this
use v5.16;
my @sorted = (sub {
...
push @{ $_ < $pivot ? \@small : \@big }, $_ for @_;
return (__SUB__->(@small), $pivot, __SUB__->(@big))
})->(@unsorted);
- or download this
use v5.16;
use List::MoreUtils 'part';
...
my ($small, $big) = part { $_ > $pivot } @_;
return (__SUB__->(@$small), $pivot, __SUB__->(@$big))
})->(@unsorted);
- or download this
my @sorted = do { my $SUB; $SUB = sub {
return @_ unless @_ > 1;
...
push @{ $_ < $pivot ? \@small : \@big }, $_ for @_;
return ($SUB->(@small), $pivot, $SUB->(@big))
}}->(@array);