Skip navigation.
Home
Your source for Perl tips, howto's, faq and tutorials
( categories: )

Use 'shuffle()' from List::Util module.

Example:

#!/usr/bin/perl
 
use List::Util qw(shuffle);
 
@sorted_array = (1, 2, 3, 4, 5, 6);
@random_array = shuffle(@sorted_array);
 
print '@random_array: ' . join(', ', @random_array) . "\n";