aboutsummaryrefslogtreecommitdiff
path: root/challenge-040/ryan-thompson/perl5/ch-2.pl
blob: b10afd623618c780173059d5bea68705e3abf4f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/env perl
#
# ch-2.pl - Sorting with slices
#
# Ryan Thompson <rjt@cpan.org>

use 5.010;
use warnings;
use strict;

my @list = (10, 4, 1, 8, 12, 3);
my @idx  = (0, 2, 5);

@list[@idx] = sort { $a <=> $b } @list[@idx];

say "@list";