Have not tried this, but I have run into this same thing. Took a look at List::MoreUtils and noticed the natatime EXPR, LIST which seems like it might do exactly what you want assuming you read your __DATA__ into an array. You did not specify whether or not the use of modules was ok for you, so I just assumed it was.
From the docs:
Does that suit your requirements?Example: my @x = ('a' .. 'g'); my $it = natatime 3, @x; while (my @vals = $it->()) { print "@vals\n"; } This prints a b c d e f g
...the majority is always wrong, and always the last to know about it...
Insanity: Doing the same thing over and over again and expecting different results...
A solution is nothing more than a clearly stated problem...otherwise, the problem is not a problem, it is a facct
In reply to Re: Refactor this to eliminate the duplicated printf?
by wjw
in thread Refactor this to eliminate the duplicated printf?
by wanna_code_perl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |