in reply to Where is the zero coming from?

It doesn't have to be more complicated than this:
use Modern::Perl '2014'; my @choices = ( 1 .. 49 ); printf "Lucky numbers: %02d %02d %02d %02d %02d %02d \n\n", sort { $a <=> $b } map { splice @choices, rand(@choices), 1 } ( 1 .. + 6 );
Basically 1 line (other than the setting up of the array to pick from) and 1 variable to hold the choices to pick from.

CountZero

A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics