Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: Printing the header row

by martin (Friar)
on Sep 13, 2012 at 15:48 UTC ( #993520=note: print w/replies, xml ) Need Help??


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); }

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://993520]
help
Chatterbox?
[Discipulus]: Tomas in greek ~140Ad
[Discipulus]: also the 'today bred' was probably 'tomorrow's bred'
[LanX]: Novum Testamentum Graece
[erix]: "give us today our bread from tomorrow" -- that's not going to fly
[choroba]: "for tomorrow"
[Discipulus]: Let's perl: from cpan website how can thou/you tell how many namespaces are beyond App::* ?
[choroba]: Map of CPAN
[LanX]: cpan serach?
[Discipulus]: about bred: 'let our bred levitate (well)'
[Discipulus]: I love maps!

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (9)
As of 2017-11-23 20:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (338 votes). Check out past polls.

    Notices?