Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
$valid="false"; While ($valid eq "false"){ #This is the 1st Line #User didn't enter anything. print "Please enter the number of tickets you want."; chomp($NumberOfTickets = <STDIN>); if ($NumberOfTickets ne ""){ $valid = "true"; }else{ print "\nYou did not enter anything, enter a number."; Next; } #User didn't enter a digit if ($NumberOfTickets =~ /[^0-9]/){ $valid = "false"; print "\nYou should only enter a digit, enter a digit."; Next; }else{ $valid="true"; } #Number of tickets should be between 1 and 10 if ($NumberOfTickets > 10 || $NumberOfTickets < 1){ $valid="false"; print "\nYou can only have 1 to 10 tickets, reenter number."; Next; }else{ $valid="true"; } #This is the 2nd Line #You can only have 6 numbers or less on a ticket. print "Please enter how many numbers you want on each ticket."; chomp($NumbersOnTickets = <STDIN>); if ($NumbersOnTickets <= "6"){ $valid = "true"; }else{ print "\nYou can only have 1 - 6 tickets, reenter number."; chomp($NumbersOnTickets = <STDIN>); Next; } if ($NumberOnTickets ne ""){ $valid = "true"; }else{ print "\nYou did not enter anything, enter a number between 1 - 6."; Next; } #User didn't enter a digit if ($NumberOnTickets =~ /[^0-9]/){ $valid = "false"; print "\nYou should only enter a digit, enter a digit."; Next; }else{ $valid="true"; } #Number of tickets should be between 1 and 6 if ($NumberOnTickets > 6 || $NumberOfTickets < 1){ $valid="false"; print "\nYou can only have 1 to 6 tickets, reenter number."; Next; }else{ $valid="true"; } #This is the 3rd Line #Highest number must be less than or equal to 56 print "Enter the highest number you want on your tickets."; chomp($HighestNumberOnTicket = <STDIN>); if ($HighestNumberOnTicket <= "56"){ $valid = "true"; }else{ print "\nYour highest number can between 1 and 56, reenter number."; chomp($HighestNumberOnTicket = <STDIN>); Next; } if ($HighestNumberOnTicket ne ""){ $valid = "true"; }else{ print "\nYou did not enter anything, enter a number between 1 - 56."; Next; } #User didn't enter a digit if ($HighestNumberOnTicket =~ /[^0-9]/){ $valid = "false"; print "\nYou should only enter a digit, enter a digit."; Next; }else{ $valid="true"; } #Number of tickets should be between 1 and 56 if ($HighestNumberOnTicket > 56 || $NumberOfTickets < 1){ $valid="false"; print "\nYour hightest number can only be between 1 to 56, reenter num +ber."; Next; }else{ $valid="true"; } for ($i=0; $i<$NumbersOnTickets; $i++) { $lotto[$i]= int(rand($HighestNumberOnTicket)) + 1; } print "Your lottery ticket number is @lotto\n"; } }

In reply to Help Perl Program - I have compilation errors don't know where by tangieb01

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!
  • 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, 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, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            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.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (5)
    As of 2014-09-21 12:30 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (168 votes), past polls