in reply to Generating 2 unique random integers (So I can't pop a list...)
Close:
use List::Util 'shuffle'; my @numbers = shuffle(1..10); my $r1 = pop(@numbers); my $r2 = pop(@numbers);
It seems like it involves an ugly amount of code to do such a trival task
If you really want it more compact, and never need to go back for more:
use List::Util 'shuffle'; my( $r1, $r2 ) = (shuffle 1..10)[ 0, 1 ];
|
|---|