use List::Util qw( shuffle ); open(my $fh, '<', '...') or die("Unable to open input file: $!\n"); my @shuffed_array = shuffle <$fh>;