- or download this
my @nums = qw(2 1 3 5 4 5 4 3 2 1); # order is not important
...
}
}
## TODO: do something with @unique
- or download this
my @nums = qw(2 1 3 5 4 5 4 3 2 1); # order is not important
my %seen = map { $_ => 1 } @nums; # build a hash; keys will be unique!
@nums = sort keys %seen; # replace old list with new sorted list
## TODO: do something with @nums
- or download this
my @nums = qw(2 1 3 5 4 5 4 3 2 1);
...
$previous = $current; # 'current' becomes 'previous'
}
## TODO: do something with @unique