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:
#!/usr/bin/perl
use strict;
use warnings;
use List::Util 'shuffle';
my @numbers = (1 .. 50);
print shuffle(@numbers);
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:
for ($i = 0; $i < @numbers; ++$i) { ... }
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!!!