in reply to While Loops
Your spec is a little ambiguous to me, but if I follow, you can do what you need using Slices and %, perhaps like:
for my $i (0 .. @data/100) { my $max = $i * 100 + 99; $max = @data - 1 if $max > @data - 1; print @data[$i * 100 .. $max]; }
Of course, you'd presumably want to do something between those prints.
#11929 First ask yourself `How would I do this without a computer?' Then have the computer do it the same way.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: While Loops
by tbone654 (Beadle) on Jan 08, 2013 at 19:07 UTC | |
by kennethk (Abbot) on Jan 08, 2013 at 19:29 UTC |
In Section
Seekers of Perl Wisdom