Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re^5: Using a Hash Variable in an If Statement

by edimusrex (Monk)
on May 12, 2015 at 00:45 UTC ( [id://1126366]=note: print w/replies, xml ) Need Help??


in reply to Re^4: Using a Hash Variable in an If Statement
in thread Using a Hash Variable in an If Statement

If you wanted to print to a csv file it can be done easily. Basically redirect all print statements to output

Example :
open my $out, ">", "rat.csv" or die "Can't write file:$!"; for my $name (@names) { print $out "$name,"; for (@{$data{$name}}) { print $out "$_,"; } print $out "\n"; $i++; } close($out);


That should give you a nice CSV which would open nicely in any text editor but more importantly Excel

Replies are listed 'Best First'.
Re^6: Using a Hash Variable in an If Statement
by 2teez (Vicar) on May 12, 2015 at 02:26 UTC

    If you wanted to print to a csv file it can be done easily...

    Yes! but not manually. Ask either Text::CSV or Text::CSV_XS to do it for you!

    If you tell me, I'll forget.
    If you show me, I'll remember.
    if you involve me, I'll understand.
    --- Author unknown to me

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-24 23:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found