Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: search date occurance from csv column

by graff (Chancellor)
on Mar 19, 2014 at 03:17 UTC ( #1078889=note: print w/replies, xml ) Need Help??

in reply to search date occurance from csv column

It's not clear what you want to get as a result from your script. When you say:

i need to use the current date search each column to get the number of occurrence from each columns

I'm afraid that doesn't make any sense in English. Perhaps you can give an example of data that should produce a particular output, and tell us what that particular output should be.

I notice that sample data you gave uses semi-colons between the fields (;), but you are using a comma in your split call (,), so @fields would always have a single element containing the whole line (because there are no commas), and $fields[2] will always be undef.

Anyway, assuming that you do the split the right way, what do you really want to do with the second date string of each line?

Replies are listed 'Best First'.
Re^2: search date occurance from csv column
by anakin30 (Acolyte) on Mar 19, 2014 at 03:42 UTC

    My apology for making things not clear

    I give you an example on what i want to achieve, let say today's date is 20140319 (based on format YYYYMMDD) i want to use this date to search the column date1 and date2 to find how many occurrence are there from each column and provide the total occurrences.

    expected output is as following

    column date1 = xx occurence

    column date2 = xx occurence


    input file

    Student ID;date1;date2






Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1078889]
and the daffodils sway...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (4)
As of 2018-05-27 12:50 GMT
Find Nodes?
    Voting Booth?