Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Generate a # between 1 and 50 in groups of 5by Hayest (Acolyte) |
on Jan 30, 2015 at 18:45 UTC ( [id://1115111]=perlquestion: print w/replies, xml ) | Need Help?? |
Hayest has asked for the wisdom of the Perl Monks concerning the following question: Hello, as the title states, I'm trying to get a Perl program to generate a number between 1 and 50 in groups of 5. This is for a school assignment, and I'm wondering where I need to go next (I am a beginner with Perl and programming in general). Here is what I have so far:
I was able to find the 'shuffle' utility which works to print my whole array (with numbers between 1 and 50). Now I know how to create a for loop which would go through each number in the array and print on a new line:
What I want to know is how would I get it to pick five of the numbers inside of it, and print them each on a new line (5 new lines with a number between 50 on each line), line break, print 5 more, line break, etc. I want the program to terminate after it does this for 5 cycles. Any thoughts? Any help would be much appreciated!!!
Back to
Seekers of Perl Wisdom
|
|