adrive has asked for the wisdom of the Perl Monks concerning the following question:
looks like i need help from the monks again :(
is there a function out there for perl array that enables me to split my array like every 5 elements? say like..
is there a function out there for perl array that enables me to split my array like every 5 elements? say like..
then at the end i'll be able to construct a nested loop that could extract them out likemy @myArray = (1..100); my @myMainArray = (); my $c = 1; foreach (@myArray){ if(c++ = 5){ #1.some splitting occurs and assign to a 5 element array #2.push 5 element array into main array #3.reset c = 1; } }
my @myArrayResult = @myMainArray; foreach my $o(@myArrayResult){ foreach my $i($o){ #print out } }
Back to
Seekers of Perl Wisdom