aboutsummaryrefslogtreecommitdiff
path: root/challenge-040/e-choroba/perl5/ch-2.pl
blob: baaf233c9aae3ca42ea4a021b602f7de42dff10a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/perl
use warnings;
use strict;

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

my @sorted = @list;
@sorted[@indices] = sort { $a <=> $b } @sorted[@indices];

my @expected = (1, 4, 3, 8, 12, 10);

"@sorted" eq "@expected"
    or die "Got:      @sorted\nExpected: @expected\n";