Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re: Creating a CSV file

by LanceDeeply (Chaplain)
on Apr 28, 2005 at 20:08 UTC ( [id://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
Domain Nodelet?
Node Status?
node history
Node Type: note [id://452455]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-03-28 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found