sub pick_numbers { my $n = shift || 6; my @numbers = grep{ my $i = $_; not grep{ $i == $_ } @_ } 1..49; return @_, map{ splice @numbers, rand(@numbers), 1 } 1..$n; }