http://www.perlmonks.org?node_id=710532

uG has asked for the wisdom of the Perl Monks concerning the following question:

use List::Util 'shuffle'; my @numbers = (1..10); my $r1 = pop(shuffle(@numbers)); my $r2 = pop(shuffle(@numbers));
I get a pretty vague error (Unknown error) from the above code, but its from the pop's. I suppose thats because shuffle is returning a list (and therefore cannot be pop'd?). Whats an elegant way to get 2 unique random numbers between 1 and x? It seems like it involves an ugly amount of code to do such a trival task :(