Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

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

by Bama_Perl (Acolyte)
on May 11, 2015 at 22:15 UTC ( [id://1126356]=note: print w/replies, xml ) Need Help??


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

OK that makes a lot of sense. One final question. Do you have an idea about how to print each each number (and its respective times) to a different column, using sprintf? Ideally I'd like to read these values into Matlab, and if I could create a column separating each number (1,2...15) with each time, that would save time rather than using Excel. Thanks for all of your help.
  • Comment on Re^4: Using a Hash Variable in an If Statement

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

    One final question. Do you have an idea about how to print each each number (and its respective times) to a different column, using sprintf?

    You can use the documentation that comes with your perl installation like so: perldoc -f sprintf from your CLI and read all about it.
    Try out what you have read and if you are still having problems with it, post such.
    The answer you seek is just right on your keyboard. :)

    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
Re^5: Using a Hash Variable in an If Statement
by edimusrex (Monk) on May 12, 2015 at 00:45 UTC
    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

      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://1126356]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (5)
As of 2024-04-24 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found