aboutsummaryrefslogtreecommitdiff
path: root/challenge-040/ryan-thompson/perl6/ch-2.p6
blob: 59b0eea35c8c3c8def6e3b2d49c0b102e3f4f523 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/env perl6

# ch-2.p6 - Sorting with slices
#
# Ryan Thompson <rjt@cpan.org>

my @list = <10 4 1 8 12 3>;
my @idx  = <0 2 5>;

# Note that Raku's sort, unlike Perl5's, will do
# a numeric sort if the list is numeric.

@list[@idx] = @list[@idx].sort;

@list.say;