in reply to Perl - Unique Numbers

List::Util
use warnings; use strict; use List::Util qw(shuffle); for ((shuffle(1..20))[0..9]) { print "$_\n"; }
1..20 creates an ordered list of numbers from 1 to 20. shuffle randomly orders the list. ()[0..9] is a slice which picks the 1st 10 numbers from the random list.

Replies are listed 'Best First'.
Re^2: Perl - Unique Numbers
by bagyi (Acolyte) on Oct 18, 2015 at 04:22 UTC
    Very concise and nice. Use library as much as possible.