Correlating Data from same .csv, line by line

Discussion in 'Perl Misc' started by shadkeene@hotmail.com, Apr 26, 2007.

  1. Guest

    Hi,
    Here's a complete but minimal example of what I'm doing with a .csv
    file (each line in the .csv file corresponds to a certain date).
    I'm reading the file and printing out simple statistics for the data
    using the grep command. However, I'd like to go a step further and
    print the date if a certain thing (or combination of things) occurred
    on that day. (i.e. if checkboxes WF and CF were checked...print the
    date that they were checked).
    My desperate but not functional attempt to correlate the values, line
    by line, and place in an array is at the bottom. Thanks for any help!
    Shad

    open(FH, "C:/perl-scripts/Data/coldseasonworksheet.csv")
    or &dienice("couldn't open output file: $!");
    seek(FH, 0, SEEK_SET); #goes to beginning of file
    my @data = <FH>; #reads file and places in array
    close(FH);

    my @ETresults = grep(/ET,/, @data);
    my $ETnum = @ETresults;

    Exiting Troughs this year=$ETnum. <br>

    #my @output = (); ###attempt...tried to use "and", "||" so the "||"
    would be read first.
    #push @output, param('DATE') and param('WF') || param('CF') for
    @fields;
     
    , Apr 26, 2007
    #1
    1. Advertising

  2. Joe Smith Guest

    wrote:
    > Here's a complete but minimal example...


    That's not a complete example. A complete example is one that I can
    copy-an-paste from your posting and execute to reproduce your problem
    on my machine. It has to be complete enough to compile with
    "use strict; use warnings;" and include any data it needs to run.

    The act of reducing the problem down to the point where it can be executed
    on another person's computer will often make the error glaringly obvious.
    Try it.

    -Joe
     
    Joe Smith, Apr 29, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Michal Mikolajczyk
    Replies:
    0
    Views:
    685
    Michal Mikolajczyk
    Feb 13, 2004
  2. Skip Montanaro
    Replies:
    0
    Views:
    752
    Skip Montanaro
    Feb 13, 2004
  3. Tintin92
    Replies:
    1
    Views:
    1,779
    Andrew Thompson
    Feb 14, 2007
  4. jliu66
    Replies:
    0
    Views:
    542
    jliu66
    Oct 19, 2007
  5. Replies:
    5
    Views:
    138
    Michele Dondi
    May 17, 2007
Loading...

Share This Page