in reply to Printing the header row
I guess the situation that the first round of an iteration provides information that is valid for all rounds, while not available before the iteration has started, is too unlikely to call for a general pattern.
That said, a way to achieve the same result with slightly prettier code alignment could be:
sub arrayref_to_csvline { ... } my $rows = 0; while (my $row = $iter->()) { print arrayref_to_csvline($row->fields) unless $rows++; print arrayref_to_csvline($row->values); }
|
---|
In Section
Cool Uses for Perl