I have implemented a lot of your suggestions above, and made the code below. Its not a serious program/project but something I wrote purely for people to critique, and you have all been very helpfull - I will remember to implement these techniques in future, thanks a lot.
#!/usr/bin/perl use strict; print qq( ------------------------------------------------------- National Lottery Number Picker ------------------------------------------------------- How many lines do you want to play? ); print "Lines.....:"; my $lines = <STDIN>; my @lines; my @line; die "Good. Don't waste your money!\n" unless $lines; my @numbers = (1..49); srand; print "\n"; &chooseline(); my $i = 1; ######################################## # Generate The Line(s) sub chooseline { while ($i < $lines) { &genline(); push @lines, @line; $i++; if ($i eq $lines) { print "\n\n"; last; } } print "\n\n"; } ######################################### # Generate the numbers sub genline { @line = ''; my $e = 1; while ($e ne "7") { my $index = rand @numbers; my $element = $numbers[$index]; print " $element"; if ($e eq "6") { print "\n"; push @line, $element; my $newline = "\n"; push @line, $newline; last; } else { push @line, $element; } $e++; } } print "(E)mail Results / (Q)uit\n\n"; print "Action....:"; my $action = <STDIN>; exit if $action =~ /^Q/i; if ($action =~ /^E/i) { print "\nEmail address...:"; my $email; $email = <STDIN>; chomp($email); die "Don't bother then, bye!" if !$email; print ("$email, is this correct? (y/n)...:"); my $dcheck = <STDIN>; exit if $dcheck =~ /^n/i; open (MAIL, "|/usr/sbin/sendmail -t"); print MAIL "To: $email\n"; print MAIL "From: Lottery Generator\n"; print MAIL "Subject: Your Lottery Numbers\n"; foreach my $lin (@lines) { print MAIL "$lin "; } close (MAIL); }

In reply to Re: Some help by Anonymous Monk
in thread Some help with a lottery picking program by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.