#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use List::Util qw{ shuffle }; my @browsers = ('firefox', 'chrome', 'internet explorer'); my %screen = map { $_ => "$_\'s screen" } @browsers; my @random_array = shuffle(@browsers); for my $b1_idx (0 .. $#random_array - 1) { my $b1 = $screen{ $random_array[$b1_idx] }; for my $b2_idx ($b1_idx + 1 .. $#random_array) { my $b2 = $screen{ $random_array[$b2_idx] }; say "About to compare $b1 with $b2"; } }