note
BrowserUk
<p>One way would be to shuffle the elements of the array and then use a slice to assign them to your vars.
<p><code>
sub shuffle (\@) {
my $r=pop;
$a = $_ + rand @{$r} - $_
and @$r[$_, $a] = @$r[$a, $_]
for (0..$#{$r});
}
my @array = (1..15);
shuffle(@array);
my ($comp1, $comp2, $comp3, $comp4, $comp5) = @array[0..4];
</code>
<hr>
<small>Nah! Your thinking of Simon Templar, originally played by Roger Moore and later by Ian Ogilvy</small>
210389
210389