What’s the best way to shuffle an array in Perl?
perl, random, shuffle
Solution
#!/usr/bin/env perl
use strict;
use warnings;
use List::Util qw/shuffle/;
my @arr = shuffle <>;
print @arr;
Usage :
./script file.txt
Problem
So I have a file. Let’s say it looks like this (it's actually longer): ``` 1234 2134 3124 4123 ``` What is the best way to shuffle the lines in that file?