in reply to Where is the zero coming from?

This is an easy way to get six random integer numbers between 1 and 49:
$ perl -e 'print int (1 + rand 49), " ", for 1..6' 48 16 40 39 21 24
Adding 1 to the result of the rand function makes it sure that the obtained integers will be between 1 and 49 (and not between 0 and 48). It can even be made slightly simpler:
$ perl -e 'print 1 + int rand 49, " ", for 1..6' 5 33 19 21 25 39

If you are under Windows, change quotes for apostrophes and vice-versa:

perl -e "print 1 + int rand 49, ' ', for 1..6"
However, besides everything that has already been said, this still suffers from a major drawback if you're going to use it for picking up lotto numbers: there is no guarantee that you don't get twice the same number. I only had to run the first Perl one-liner above 9 times to get the following result:
$ perl -e 'print int (1 + rand 49), " ", for 1..6' 20 32 37 32 3 39
where number 32 appears twice, which is not good for lotto numbers. Since this looks a bit like a homework assignment, I'll leave it to you to find out how to make an additional draw if you find a number that has already been picked up.

A final additional advice: don't comment out use strict;, rather solve the problems that it diagnoses (hint: use my to declare your variables).

Replies are listed 'Best First'.
Re^2: Where is the zero coming from?
by Pauleduc (Initiate) on Aug 02, 2014 at 20:56 UTC
    Once again, I thank everyone for your comments and suggestions... some of which use code that I have not yet studied, but will eventually get there. Keep in mind that this is a hobby with me and I am only half way thru my perl for dummies book :-) But again, I do appreciate the responses. The script was not meant to be practical, but rather an exercise in learning basic perl.
      My own personal opinion is that you should probably not use the "Perl for dummies" book, it is really not very good. Actually, as far as CS is concerned, most of the "XXX for dummies" books are bad and seem to be aimed as making you a dummy. Use the O'Reilly books instead if you can, their are much much better. "Learning Perl", by O'Reilly, is probably my best advice for a starter.