Created
April 19, 2013 19:43
-
-
Save masak/5422713 to your computer and use it in GitHub Desktop.
Shuffle everything but the first element
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ perl shuffle-stuff | |
1 | |
4 | |
5 | |
8 | |
10 | |
3 | |
2 | |
6 | |
7 | |
9 | |
$ cat shuffle-stuff | |
use 5.010; | |
use strict; | |
use warnings; | |
use List::Util qw(shuffle); | |
my @things = 1..10; | |
@things = ($things[0], shuffle(@things[1..@things-1])); | |
for my $t (@things) { | |
say $t; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment