use List::Util qw(shuffle); my @random_array = shuffle(@browsers); for my $b1_idx (0 .. $#random_array - 1)