Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Creating a CSV file

by LanceDeeply (Chaplain)
on Apr 28, 2005 at 20:08 UTC ( #452455=note: print w/replies, xml ) Need Help??


in reply to Creating a CSV file

you could split on colon space and then use map to ensure the order of your values matches the order of your keys... but, as Transient stated, your order is already ok
my %hash; while ( <DATA> ) { chomp; my @ar = split /\: /,$_; $hash{$ar[0]} = $ar[1]; } my @keys = keys %hash; my @values = map { $hash{$_} } @keys; print join ",",@keys; print "\n"; print join ",",@values; print "\n"; __DATA__ Update Time: 2005.04.27 15:44:12 Targets: 4 Complete: 4(100%) Waiting: 0

Waiting,Targets,Update Time,Complete 0,4,2005.04.27 15:44:12,4(100%)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://452455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2021-05-11 00:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Perl 7 will be out ...





    Results (109 votes). Check out past polls.

    Notices?