Correlating Data from same .csv, line by line

S

shadkeene

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;
 
J

Joe Smith

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top