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.use warnings; use strict; use List::Util qw(shuffle); for ((shuffle(1..20))[0..9]) { print "$_\n"; }
In reply to Re: Perl - Unique Numbers
by toolic
in thread Perl - Unique Numbers
by deelinux
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |